diff options
author | ilezhankin <ilezhankin@yandex-team.ru> | 2022-02-10 16:45:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:56 +0300 |
commit | 62a805381e41500fbc7914c37c71ab040a098f4e (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/network/sock.h | |
parent | 1d125034f06575234f83f24f08677955133f140e (diff) | |
download | ydb-62a805381e41500fbc7914c37c71ab040a098f4e.tar.gz |
Restoring authorship annotation for <ilezhankin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/network/sock.h')
-rw-r--r-- | util/network/sock.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/util/network/sock.h b/util/network/sock.h index 88835bd676..b10be2f715 100644 --- a/util/network/sock.h +++ b/util/network/sock.h @@ -1,6 +1,6 @@ #pragma once -#include <util/folder/path.h> +#include <util/folder/path.h> #include <util/system/defaults.h> #include <util/string/cast.h> #include <util/stream/output.h> @@ -89,10 +89,10 @@ struct TSockAddrLocal: public ISockAddr { return TString(Path); } - TFsPath ToPath() const { - return TFsPath(Path); - } - + TFsPath ToPath() const { + return TFsPath(Path); + } + int ResolveAddr() const { if (in.sin_port == 0) { int ret = 0; @@ -182,10 +182,10 @@ struct TSockAddrLocal: public sockaddr_un, public ISockAddr { return TString(sun_path); } - TFsPath ToPath() const { - return TFsPath(sun_path); - } - + TFsPath ToPath() const { + return TFsPath(sun_path); + } + int Bind(SOCKET s, ui16 mode) const override { (void)unlink(sun_path); @@ -405,7 +405,7 @@ public: class TStreamSocket: public TBaseSocket { protected: - explicit TStreamSocket(SOCKET fd) + explicit TStreamSocket(SOCKET fd) : TBaseSocket(fd) { } @@ -413,9 +413,9 @@ protected: public: TStreamSocket() : TBaseSocket(INVALID_SOCKET) - { - } - + { + } + ssize_t Send(const void* msg, size_t len, int flags = 0) { const ssize_t ret = send((SOCKET) * this, (const char*)msg, (int)len, flags); if (ret < 0) @@ -452,15 +452,15 @@ public: return ret; } - int Accept(TStreamSocket* acceptedSock, ISockAddr* acceptedAddr = nullptr) { - SOCKET s = INVALID_SOCKET; - if (acceptedAddr) { - socklen_t acceptedSize = acceptedAddr->Size(); - s = accept((SOCKET) * this, acceptedAddr->SockAddr(), &acceptedSize); - } else { - s = accept((SOCKET) * this, nullptr, nullptr); - } - + int Accept(TStreamSocket* acceptedSock, ISockAddr* acceptedAddr = nullptr) { + SOCKET s = INVALID_SOCKET; + if (acceptedAddr) { + socklen_t acceptedSize = acceptedAddr->Size(); + s = accept((SOCKET) * this, acceptedAddr->SockAddr(), &acceptedSize); + } else { + s = accept((SOCKET) * this, nullptr, nullptr); + } + if (s == INVALID_SOCKET) return -errno; |