mirror of https://github.com/grpc/grpc-dart.git
Use tcpNoDelay option for sockets (#298)
This commit is contained in:
parent
03ecb84064
commit
39c751128c
|
|
@ -78,6 +78,8 @@ class Http2ClientConnection implements connection.ClientConnection {
|
||||||
Future<ClientTransportConnection> connectTransport() async {
|
Future<ClientTransportConnection> connectTransport() async {
|
||||||
final securityContext = credentials.securityContext;
|
final securityContext = credentials.securityContext;
|
||||||
Socket socket = await Socket.connect(host, port);
|
Socket socket = await Socket.connect(host, port);
|
||||||
|
// Don't wait for io buffers to fill up before sending requests.
|
||||||
|
socket.setOption(SocketOption.tcpNoDelay, true);
|
||||||
if (securityContext != null) {
|
if (securityContext != null) {
|
||||||
// Todo(sigurdm): We want to pass supportedProtocols: ['h2']. http://dartbug.com/37950
|
// Todo(sigurdm): We want to pass supportedProtocols: ['h2']. http://dartbug.com/37950
|
||||||
socket = await SecureSocket.secure(socket,
|
socket = await SecureSocket.secure(socket,
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,17 @@ class Server {
|
||||||
server = _secureServer;
|
server = _secureServer;
|
||||||
} else {
|
} else {
|
||||||
_insecureServer = await ServerSocket.bind(
|
_insecureServer = await ServerSocket.bind(
|
||||||
address ?? InternetAddress.anyIPv4, port ?? 80, backlog: backlog, shared: shared , v6Only: v6Only);
|
address ?? InternetAddress.anyIPv4,
|
||||||
|
port ?? 80,
|
||||||
|
backlog: backlog,
|
||||||
|
shared: shared,
|
||||||
|
v6Only: v6Only,
|
||||||
|
);
|
||||||
server = _insecureServer;
|
server = _insecureServer;
|
||||||
}
|
}
|
||||||
server.listen((socket) {
|
server.listen((socket) {
|
||||||
|
// Don't wait for io buffers to fill up before sending requests.
|
||||||
|
socket.setOption(SocketOption.tcpNoDelay, true);
|
||||||
final connection = ServerTransportConnection.viaSocket(socket,
|
final connection = ServerTransportConnection.viaSocket(socket,
|
||||||
settings: http2ServerSettings);
|
settings: http2ServerSettings);
|
||||||
_connections.add(connection);
|
_connections.add(connection);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue