stream-tcp: Use closesocket instead of close for sockets.
authorGurucharan Shetty <gshetty@nicira.com>
Thu, 27 Mar 2014 23:39:35 +0000 (16:39 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Fri, 28 Mar 2014 17:53:47 +0000 (10:53 -0700)
We should use closesocket() while closing sockets so that
closing sockets work fine on both POSIX and Windows.
(In POSIX, we #define closesocket close)

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/stream-tcp.c

index 4cd4e6f..d62e9c3 100644 (file)
@@ -58,7 +58,7 @@ new_tcp_stream(const char *name, int fd, int connect_status,
         int error = sock_errno();
         VLOG_ERR("%s: setsockopt(TCP_NODELAY): %s",
                  name, sock_strerror(error));
-        close(fd);
+        closesocket(fd);
         return error;
     }