summaryrefslogtreecommitdiff
path: root/src/plugins/xfer/xfer-dcc.c
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2018-03-28 09:30:32 +0200
committerDominique Martinet <asmadeus@codewreck.org>2018-03-28 09:32:18 +0200
commit57e8c9954663d616f85a5ccebbc4412d23728e17 (patch)
treed0aa7f3f881f23d47de765afea8841900daf76cd /src/plugins/xfer/xfer-dcc.c
parent9490c6949bda61f72aa3c8f03be2b0f454966065 (diff)
downloadweechat-57e8c9954663d616f85a5ccebbc4412d23728e17.zip
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.
Diffstat (limited to 'src/plugins/xfer/xfer-dcc.c')
-rw-r--r--src/plugins/xfer/xfer-dcc.c6
1 files changed, 6 insertions, 0 deletions
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 <sys/socket.h>
#include <poll.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <fcntl.h>
#include <time.h>
#include <netdb.h>
@@ -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);