From b8973c10ab26954026e8ea4952aaec085f90b1c6 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 18 May 2020 19:41:40 +0200 Subject: [PATCH] Use proper constants for socket shutdown() For readability. --- common/network/Socket.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/network/Socket.cxx b/common/network/Socket.cxx index 9dd8bfe1..78484f51 100644 --- a/common/network/Socket.cxx +++ b/common/network/Socket.cxx @@ -25,6 +25,9 @@ #include #include #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 } -- 2.39.5