diff options
author | David Galeano <davidgaleano@gmail.com> | 2017-06-27 01:09:49 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-06-27 02:09:49 +0200 |
commit | 1ef2d768e71981e4429376a0cb25dbed14dfae52 (patch) | |
tree | 05572641694f9221dcef7464cb628f3e908c86b9 | |
parent | 2b377d89dbe4174a74e021ffe4e8b86d0d729d0e (diff) | |
download | rneovim-1ef2d768e71981e4429376a0cb25dbed14dfae52.tar.gz rneovim-1ef2d768e71981e4429376a0cb25dbed14dfae52.tar.bz2 rneovim-1ef2d768e71981e4429376a0cb25dbed14dfae52.zip |
socket.c: Disable Nagle's algorithm on TCP sockets (#6915)
Reducing latency is more interesting than optimizing bandwidth
for Nvim's typical use-cases.
-rw-r--r-- | src/nvim/event/socket.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 30a71a5586..a796f303ab 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -66,6 +66,7 @@ int socket_watcher_init(Loop *loop, SocketWatcher *watcher, watcher->uv.tcp.addrinfo = request.addrinfo; uv_tcp_init(&loop->uv, &watcher->uv.tcp.handle); + uv_tcp_nodelay(&watcher->uv.tcp.handle, true); watcher->stream = STRUCT_CAST(uv_stream_t, &watcher->uv.tcp.handle); } else { uv_pipe_init(&loop->uv, &watcher->uv.pipe.handle, 0); @@ -146,6 +147,7 @@ int socket_watcher_accept(SocketWatcher *watcher, Stream *stream) if (watcher->stream->type == UV_TCP) { client = STRUCT_CAST(uv_stream_t, &stream->uv.tcp); uv_tcp_init(watcher->uv.tcp.handle.loop, (uv_tcp_t *)client); + uv_tcp_nodelay((uv_tcp_t *)client, true); } else { client = STRUCT_CAST(uv_stream_t, &stream->uv.pipe); uv_pipe_init(watcher->uv.pipe.handle.loop, (uv_pipe_t *)client, 0); @@ -237,6 +239,7 @@ bool socket_connect(Loop *loop, Stream *stream, tcp_retry: uv_tcp_init(&loop->uv, tcp); + uv_tcp_nodelay(tcp, true); uv_tcp_connect(&req, tcp, addrinfo->ai_addr, connect_cb); uv_stream = (uv_stream_t *)tcp; |