diff options
author | mvel <mvel@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
commit | 43f5a35593ebc9f6bcea619bb170394ea7ae468e (patch) | |
tree | e98df59de24d2ef7c77baed9f41e4875a2fef972 /util/network | |
parent | bd30392c4cc92487950adc375c07adf52da1d592 (diff) | |
download | ydb-43f5a35593ebc9f6bcea619bb170394ea7ae468e.tar.gz |
Restoring authorship annotation for <mvel@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/network')
-rw-r--r-- | util/network/sock_ut.cpp | 2 | ||||
-rw-r--r-- | util/network/socket.cpp | 32 | ||||
-rw-r--r-- | util/network/socket.h | 8 |
3 files changed, 21 insertions, 21 deletions
diff --git a/util/network/sock_ut.cpp b/util/network/sock_ut.cpp index f64a4993db..fd8c783747 100644 --- a/util/network/sock_ut.cpp +++ b/util/network/sock_ut.cpp @@ -83,7 +83,7 @@ Y_UNIT_TEST_SUITE(TSocketTest) { cliSock.CheckSock(); servSock.CheckSock(); newSock.CheckSock(); - + // server int yes = 1; CheckedSetSockOpt(servSock, SOL_SOCKET, SO_REUSEADDR, yes, "servSock, SO_REUSEADDR"); diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 9ad5ff276c..4f6e804346 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -432,22 +432,22 @@ void SetSocketPriority(SOCKET s, int priority) { #endif } -bool HasLocalAddress(SOCKET socket) { - TOpaqueAddr localAddr; - if (getsockname(socket, localAddr.MutableAddr(), localAddr.LenPtr()) != 0) { - ythrow TSystemError() << "HasLocalAddress: getsockname() failed. "; - } - if (IsLoopback(localAddr)) { - return true; - } - - TOpaqueAddr remoteAddr; - if (getpeername(socket, remoteAddr.MutableAddr(), remoteAddr.LenPtr()) != 0) { - ythrow TSystemError() << "HasLocalAddress: getpeername() failed. "; - } - return IsSame(localAddr, remoteAddr); -} - +bool HasLocalAddress(SOCKET socket) { + TOpaqueAddr localAddr; + if (getsockname(socket, localAddr.MutableAddr(), localAddr.LenPtr()) != 0) { + ythrow TSystemError() << "HasLocalAddress: getsockname() failed. "; + } + if (IsLoopback(localAddr)) { + return true; + } + + TOpaqueAddr remoteAddr; + if (getpeername(socket, remoteAddr.MutableAddr(), remoteAddr.LenPtr()) != 0) { + ythrow TSystemError() << "HasLocalAddress: getpeername() failed. "; + } + return IsSame(localAddr, remoteAddr); +} + namespace { #if defined(_linux_) #if !defined(TCP_FASTOPEN) diff --git a/util/network/socket.h b/util/network/socket.h index 646869bbaa..40c8648b40 100644 --- a/util/network/socket.h +++ b/util/network/socket.h @@ -118,7 +118,7 @@ int GetSocketToS(SOCKET s); int GetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr); void SetSocketPriority(SOCKET s, int priority); void SetTcpFastOpen(SOCKET s, int qlen); -/** +/** * Deprecated, consider using HasSocketDataToRead instead. **/ bool IsNotSocketClosedByOtherSide(SOCKET s); @@ -132,9 +132,9 @@ enum class ESocketReadStatus { **/ ESocketReadStatus HasSocketDataToRead(SOCKET s); /** - * Determines whether connection on socket is local (same machine) or not. - **/ -bool HasLocalAddress(SOCKET socket); + * Determines whether connection on socket is local (same machine) or not. + **/ +bool HasLocalAddress(SOCKET socket); /** * Runtime check if current kernel supports SO_REUSEPORT option. |