mirror of https://github.com/grpc/grpc-dart.git
Tweaks. (#82)
Using address: 'localhost' didn't work as expected in the Docker environment, so reverting to old behavior. Fixed a typo.
This commit is contained in:
parent
38ad37e2ef
commit
88485bad11
|
@ -136,7 +136,6 @@ Future<Null> main(List<String> args) async {
|
||||||
tlsCredentials = new ServerTlsCredentials(
|
tlsCredentials = new ServerTlsCredentials(
|
||||||
certificate: await certificate, privateKey: await privateKey);
|
certificate: await certificate, privateKey: await privateKey);
|
||||||
}
|
}
|
||||||
await server.serve(
|
await server.serve(port: port, security: tlsCredentials);
|
||||||
address: 'localhost', port: port, security: tlsCredentials);
|
|
||||||
print('Server listening on port ${server.port}...');
|
print('Server listening on port ${server.port}...');
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,26 +246,26 @@ class ServerHandler extends ServiceCall {
|
||||||
void sendTrailers({int status = 0, String message}) {
|
void sendTrailers({int status = 0, String message}) {
|
||||||
_timeoutTimer?.cancel();
|
_timeoutTimer?.cancel();
|
||||||
|
|
||||||
final outogingTrailersMap = <String, String>{};
|
final outgoingTrailersMap = <String, String>{};
|
||||||
if (!_headersSent) {
|
if (!_headersSent) {
|
||||||
// TODO(jakobr): Should come from package:http2?
|
// TODO(jakobr): Should come from package:http2?
|
||||||
outogingTrailersMap[':status'] = '200';
|
outgoingTrailersMap[':status'] = '200';
|
||||||
outogingTrailersMap['content-type'] = 'application/grpc';
|
outgoingTrailersMap['content-type'] = 'application/grpc';
|
||||||
|
|
||||||
_customHeaders..remove(':status')..remove('content-type');
|
_customHeaders..remove(':status')..remove('content-type');
|
||||||
outogingTrailersMap.addAll(_customHeaders);
|
outgoingTrailersMap.addAll(_customHeaders);
|
||||||
_customHeaders = null;
|
_customHeaders = null;
|
||||||
}
|
}
|
||||||
_customTrailers..remove(':status')..remove('content-type');
|
_customTrailers..remove(':status')..remove('content-type');
|
||||||
outogingTrailersMap.addAll(_customTrailers);
|
outgoingTrailersMap.addAll(_customTrailers);
|
||||||
_customTrailers = null;
|
_customTrailers = null;
|
||||||
outogingTrailersMap['grpc-status'] = status.toString();
|
outgoingTrailersMap['grpc-status'] = status.toString();
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
outogingTrailersMap['grpc-message'] = message;
|
outgoingTrailersMap['grpc-message'] = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
final outgoingTrailers = <Header>[];
|
final outgoingTrailers = <Header>[];
|
||||||
outogingTrailersMap.forEach(
|
outgoingTrailersMap.forEach(
|
||||||
(key, value) => outgoingTrailers.add(new Header.ascii(key, value)));
|
(key, value) => outgoingTrailers.add(new Header.ascii(key, value)));
|
||||||
_stream.sendHeaders(outgoingTrailers, endStream: true);
|
_stream.sendHeaders(outgoingTrailers, endStream: true);
|
||||||
// We're done!
|
// We're done!
|
||||||
|
|
Loading…
Reference in New Issue