]> source.dussan.org Git - tigervnc.git/commitdiff
Use proper constants for socket shutdown()
authorPierre Ossman <ossman@cendio.se>
Mon, 18 May 2020 17:41:40 +0000 (19:41 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 21 May 2020 09:34:22 +0000 (11:34 +0200)
For readability.

common/network/Socket.cxx

index 9dd8bfe13255393097dfd26f51804ad3b78b6360..78484f51cec645b27c7e7582202c0d5ce47d2eac 100644 (file)
@@ -25,6 +25,9 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #define errorNumber WSAGetLastError()
+#define SHUT_RD SD_RECEIVE
+#define SHUT_WR SD_SEND
+#define SHUT_RDWR SD_BOTH
 #else
 #define errorNumber errno
 #define closesocket close
@@ -94,7 +97,7 @@ Socket::~Socket()
 void Socket::shutdown()
 {
   isShutdown_ = true;
-  ::shutdown(getFd(), 2);
+  ::shutdown(getFd(), SHUT_RDWR);
 }
 
 bool Socket::isShutdown() const
@@ -149,7 +152,7 @@ void SocketListener::shutdown()
   closesocket(fd);
   fd = -1;
 #else
-  ::shutdown(fd, 2);
+  ::shutdown(fd, SHUT_RDWR);
 #endif
 }