aboutsummaryrefslogtreecommitdiffstats
path: root/util/network
diff options
context:
space:
mode:
authornocomer <nocomer@yandex-team.ru>2022-02-10 16:51:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:51:48 +0300
commit98445ce16e046ec9528200234bd53fcf7f9aa61b (patch)
tree4f780439b0f3f7ed13e6914fccf3434f047e761e /util/network
parent1dbd640faa41bcc5e0706aa58be73600774045eb (diff)
downloadydb-98445ce16e046ec9528200234bd53fcf7f9aa61b.tar.gz
Restoring authorship annotation for <nocomer@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/network')
-rw-r--r--util/network/socket.cpp22
-rw-r--r--util/network/socket.h20
2 files changed, 21 insertions, 21 deletions
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 4f6e804346..fe4e6eab2c 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -523,18 +523,18 @@ static int MsgPeek(SOCKET s) {
}
bool IsNotSocketClosedByOtherSide(SOCKET s) {
- return HasSocketDataToRead(s) != ESocketReadStatus::SocketClosed;
-}
-
-ESocketReadStatus HasSocketDataToRead(SOCKET s) {
+ return HasSocketDataToRead(s) != ESocketReadStatus::SocketClosed;
+}
+
+ESocketReadStatus HasSocketDataToRead(SOCKET s) {
const int r = MsgPeek(s);
- if (r == -1 && IsBlocked(LastSystemError())) {
- return ESocketReadStatus::NoData;
- }
- if (r > 0) {
- return ESocketReadStatus::HasData;
- }
- return ESocketReadStatus::SocketClosed;
+ if (r == -1 && IsBlocked(LastSystemError())) {
+ return ESocketReadStatus::NoData;
+ }
+ if (r > 0) {
+ return ESocketReadStatus::HasData;
+ }
+ return ESocketReadStatus::SocketClosed;
}
#if defined(_win_)
diff --git a/util/network/socket.h b/util/network/socket.h
index 40c8648b40..4588f0bd1d 100644
--- a/util/network/socket.h
+++ b/util/network/socket.h
@@ -119,19 +119,19 @@ 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.
+ * Deprecated, consider using HasSocketDataToRead instead.
**/
bool IsNotSocketClosedByOtherSide(SOCKET s);
-enum class ESocketReadStatus {
- HasData,
- NoData,
- SocketClosed
-};
-/**
- * Useful for keep-alive connections.
- **/
-ESocketReadStatus HasSocketDataToRead(SOCKET s);
+enum class ESocketReadStatus {
+ HasData,
+ NoData,
+ SocketClosed
+};
/**
+ * Useful for keep-alive connections.
+ **/
+ESocketReadStatus HasSocketDataToRead(SOCKET s);
+/**
* Determines whether connection on socket is local (same machine) or not.
**/
bool HasLocalAddress(SOCKET socket);