summaryrefslogtreecommitdiff
path: root/socket/tcp-passive.c
diff options
context:
space:
mode:
Diffstat (limited to 'socket/tcp-passive.c')
-rw-r--r--socket/tcp-passive.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/socket/tcp-passive.c b/socket/tcp-passive.c
index 16fbe3d..131ff4b 100644
--- a/socket/tcp-passive.c
+++ b/socket/tcp-passive.c
@@ -50,6 +50,11 @@
#include <unistd.h>
#endif
+/* FIXME: This should be defined in gio/gnetworking.h, which we should include;
+ * but we cannot do that without refactoring.
+ * (See: https://phabricator.freedesktop.org/D230). */
+#define TCP_NODELAY 1
+
typedef struct {
GMainContext *context;
GHashTable *connections;
@@ -284,6 +289,9 @@ nice_tcp_passive_socket_accept (NiceSocket *sock)
/* GSocket: All socket file descriptors are set to be close-on-exec. */
g_socket_set_blocking (gsock, false);
+ /* setting TCP_NODELAY to TRUE in order to avoid packet batching */
+ g_socket_set_option (gsock, IPPROTO_TCP, TCP_NODELAY, TRUE, NULL);
+
gaddr = g_socket_get_remote_address (gsock, NULL);
if (gaddr == NULL ||
!g_socket_address_to_native (gaddr, &name.addr, sizeof (name), NULL)) {