From 57e8c9954663d616f85a5ccebbc4412d23728e17 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 28 Mar 2018 09:30:32 +0200 Subject: xfer: set TCP_NODELAY on recv side This works around hangs where only a couple of bytes could be sent to the socket and retrying to send the last bytes of the ack never seem to work. Closes #1167. --- src/plugins/xfer/xfer-dcc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/xfer/xfer-dcc.c') diff --git a/src/plugins/xfer/xfer-dcc.c b/src/plugins/xfer/xfer-dcc.c index 44fc56caf..19d9ee99a 100644 --- a/src/plugins/xfer/xfer-dcc.c +++ b/src/plugins/xfer/xfer-dcc.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -345,6 +346,11 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer) return; } + /* set TCP_NODELAY to be more aggressive with acks */ + /* ignore error as transfer should still work if this fails */ + flags = 1; + setsockopt(xfer->sock, IPPROTO_TCP, TCP_NODELAY, &flags, sizeof(flags)); + /* connection is OK, change DCC status (inform parent process) */ xfer_network_write_pipe (xfer, XFER_STATUS_ACTIVE, XFER_NO_ERROR); -- cgit v1.2.3