datapath-windows: set the nlBuf tail properly
[cascardo/ovs.git] / lib / socket-util.c
index c0438d9..8949da7 100644 (file)
@@ -21,6 +21,7 @@
 #include <fcntl.h>
 #include <net/if.h>
 #include <netdb.h>
+#include <netinet/tcp.h>
 #include <poll.h>
 #include <stddef.h>
 #include <stdio.h>
@@ -36,7 +37,7 @@
 #include "packets.h"
 #include "poll-loop.h"
 #include "util.h"
-#include "vlog.h"
+#include "openvswitch/vlog.h"
 #ifdef __linux__
 #include <linux/if_packet.h>
 #endif
@@ -87,6 +88,19 @@ xset_nonblocking(int fd)
     }
 }
 
+void
+setsockopt_tcp_nodelay(int fd)
+{
+    int on = 1;
+    int retval;
+
+    retval = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on);
+    if (retval) {
+        retval = sock_errno();
+        VLOG_ERR("setsockopt(TCP_NODELAY): %s", sock_strerror(retval));
+    }
+}
+
 int
 set_dscp(int fd, uint8_t dscp)
 {