Skip to content

Commit

Permalink
slirp: disable Nagle in outgoing connections
Browse files Browse the repository at this point in the history
When setting up an outgoing user mode networking TCP connection,
disable the Nagle algorithm in the host-side connection.  Either the
guest is already doing Nagle, in which case there is no point in doing
it twice, or it has chosen to disable it, in which case we should
respect that choice.

This change speeds up GDB remote debugging over TCP over user mode
networking (with GDB runing on the guest) by multiple orders of
magnitude, and has been part of the local patches applied by pkgsrc
since 2012 with no reported ill effects.

Signed-off-by: Andreas Gustafsson <gson@gson.org>
Reviewed-by: Kamil Rytarowski <n54@gmx.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
  • Loading branch information
Andreas Gustafsson authored and sthibaul committed May 31, 2018
1 parent f18d137 commit 058665b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions slirp/tcp_subr.c
Expand Up @@ -416,6 +416,8 @@ int tcp_fconnect(struct socket *so, unsigned short af)
socket_set_fast_reuse(s);
opt = 1;
qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt));
opt = 1;
qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));

addr = so->fhost.ss;
DEBUG_CALL(" connect()ing")
Expand Down

0 comments on commit 058665b

Please sign in to comment.