1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

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.
This commit is contained in:
Dominique Martinet
2018-03-28 09:30:32 +02:00
parent 9490c6949b
commit 57e8c99546
+6
View File
@@ -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);