diff options
author | defencer <[email protected]> | 2022-02-10 16:52:01 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:52:01 +0300 |
commit | bab6bea2cd46463bec931057fae2181f02d211d2 (patch) | |
tree | ab7fbbf3253d4c0e2793218f09378908beb025fb | |
parent | b42710018bef676796d30f8e874d4604b062e57d (diff) |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
-rw-r--r-- | util/network/socket.cpp | 36 | ||||
-rw-r--r-- | util/network/socket.h | 2 |
2 files changed, 19 insertions, 19 deletions
diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 03063bec787..4f6e8043462 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -325,26 +325,26 @@ void SetNoDelay(SOCKET s, bool value) { CheckedSetSockOpt(s, IPPROTO_TCP, TCP_NODELAY, (int)value, "tcp no delay"); } -void SetCloseOnExec(SOCKET s, bool value) { -#if defined(_unix_) - int flags = fcntl(s, F_GETFD); - if (flags == -1) { - ythrow TSystemError() << "fcntl() failed"; - } - if (value) { - flags |= FD_CLOEXEC; - } else { - flags &= ~FD_CLOEXEC; - } - if (fcntl(s, F_SETFD, flags) == -1) { - ythrow TSystemError() << "fcntl() failed"; - } -#else +void SetCloseOnExec(SOCKET s, bool value) { +#if defined(_unix_) + int flags = fcntl(s, F_GETFD); + if (flags == -1) { + ythrow TSystemError() << "fcntl() failed"; + } + if (value) { + flags |= FD_CLOEXEC; + } else { + flags &= ~FD_CLOEXEC; + } + if (fcntl(s, F_SETFD, flags) == -1) { + ythrow TSystemError() << "fcntl() failed"; + } +#else Y_UNUSED(s); Y_UNUSED(value); -#endif -} - +#endif +} + size_t GetMaximumSegmentSize(SOCKET s) { #if defined(TCP_MAXSEG) int val; diff --git a/util/network/socket.h b/util/network/socket.h index 5fe24d1deb0..40c8648b409 100644 --- a/util/network/socket.h +++ b/util/network/socket.h @@ -103,7 +103,7 @@ void SetKeepAlive(SOCKET s); void SetLinger(SOCKET s, bool on, unsigned len); void SetZeroLinger(SOCKET s); void SetKeepAlive(SOCKET s, bool value); -void SetCloseOnExec(SOCKET s, bool value); +void SetCloseOnExec(SOCKET s, bool value); void SetOutputBuffer(SOCKET s, unsigned value); void SetInputBuffer(SOCKET s, unsigned value); void SetReusePort(SOCKET s, bool value); |