aboutsummaryrefslogtreecommitdiffstats
path: root/util/network
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/network
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'util/network')
-rw-r--r--util/network/address.cpp4
-rw-r--r--util/network/address.h22
-rw-r--r--util/network/address_ut.cpp8
-rw-r--r--util/network/endpoint.cpp2
-rw-r--r--util/network/endpoint.h6
-rw-r--r--util/network/endpoint_ut.cpp8
-rw-r--r--util/network/interface.cpp2
-rw-r--r--util/network/interface.h4
-rw-r--r--util/network/iovec.h12
-rw-r--r--util/network/ip.h28
-rw-r--r--util/network/nonblock.cpp2
-rw-r--r--util/network/poller.h2
-rw-r--r--util/network/pollerimpl.h86
-rw-r--r--util/network/sock.h46
-rw-r--r--util/network/socket.cpp40
-rw-r--r--util/network/socket.h76
-rw-r--r--util/network/socket_ut.cpp14
17 files changed, 181 insertions, 181 deletions
diff --git a/util/network/address.cpp b/util/network/address.cpp
index 91d2608235..a81a9e6994 100644
--- a/util/network/address.cpp
+++ b/util/network/address.cpp
@@ -118,13 +118,13 @@ void NAddr::PrintHost(IOutputStream& out, const IRemoteAddr& addr) {
PrintAddr<false>(out, addr);
}
-TString NAddr::PrintHost(const IRemoteAddr& addr) {
+TString NAddr::PrintHost(const IRemoteAddr& addr) {
TStringStream ss;
PrintAddr<false>(ss, addr);
return ss.Str();
}
-TString NAddr::PrintHostAndPort(const IRemoteAddr& addr) {
+TString NAddr::PrintHostAndPort(const IRemoteAddr& addr) {
TStringStream ss;
PrintAddr<true>(ss, addr);
return ss.Str();
diff --git a/util/network/address.h b/util/network/address.h
index 7bbf25331c..448fcac0c9 100644
--- a/util/network/address.h
+++ b/util/network/address.h
@@ -4,7 +4,7 @@
#include "socket.h"
#include <util/generic/ptr.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
namespace NAddr {
class IRemoteAddr {
@@ -22,8 +22,8 @@ namespace NAddr {
IRemoteAddrPtr GetPeerAddr(SOCKET s);
void PrintHost(IOutputStream& out, const IRemoteAddr& addr);
- TString PrintHost(const IRemoteAddr& addr);
- TString PrintHostAndPort(const IRemoteAddr& addr);
+ TString PrintHost(const IRemoteAddr& addr);
+ TString PrintHostAndPort(const IRemoteAddr& addr);
bool IsLoopback(const IRemoteAddr& addr);
bool IsSame(const IRemoteAddr& lhs, const IRemoteAddr& rhs);
@@ -33,13 +33,13 @@ namespace NAddr {
//for accept, recvfrom - see LenPtr()
class TOpaqueAddr: public IRemoteAddr {
public:
- inline TOpaqueAddr() noexcept
+ inline TOpaqueAddr() noexcept
: L_(sizeof(S_))
{
Zero(S_);
}
- inline TOpaqueAddr(const IRemoteAddr* addr) noexcept {
+ inline TOpaqueAddr(const IRemoteAddr* addr) noexcept {
Assign(addr->Addr(), addr->Len());
}
@@ -55,16 +55,16 @@ namespace NAddr {
return L_;
}
- inline sockaddr* MutableAddr() const noexcept {
+ inline sockaddr* MutableAddr() const noexcept {
return (sockaddr*)&S_;
}
- inline socklen_t* LenPtr() noexcept {
+ inline socklen_t* LenPtr() noexcept {
return &L_;
}
private:
- inline void Assign(const sockaddr* addr, socklen_t len) noexcept {
+ inline void Assign(const sockaddr* addr, socklen_t len) noexcept {
L_ = len;
memcpy(MutableAddr(), addr, L_);
}
@@ -77,7 +77,7 @@ namespace NAddr {
//for TNetworkAddress
class TAddrInfo: public IRemoteAddr {
public:
- inline TAddrInfo(const addrinfo* ai) noexcept
+ inline TAddrInfo(const addrinfo* ai) noexcept
: AI_(ai)
{
}
@@ -97,7 +97,7 @@ namespace NAddr {
//compat, for TIpAddress
class TIPv4Addr: public IRemoteAddr {
public:
- inline TIPv4Addr(const TIpAddress& addr) noexcept
+ inline TIPv4Addr(const TIpAddress& addr) noexcept
: A_(addr)
{
}
@@ -117,7 +117,7 @@ namespace NAddr {
//same, for ipv6 addresses
class TIPv6Addr: public IRemoteAddr {
public:
- inline TIPv6Addr(const sockaddr_in6& a) noexcept
+ inline TIPv6Addr(const sockaddr_in6& a) noexcept
: A_(a)
{
}
diff --git a/util/network/address_ut.cpp b/util/network/address_ut.cpp
index 71d225c692..28f45172ff 100644
--- a/util/network/address_ut.cpp
+++ b/util/network/address_ut.cpp
@@ -9,12 +9,12 @@ Y_UNIT_TEST_SUITE(IRemoteAddr_ToString) {
THolder<TOpaqueAddr> opaque(new TOpaqueAddr);
IRemoteAddr* addr = opaque.Get();
- TString s = ToString(*addr);
+ TString s = ToString(*addr);
UNIT_ASSERT_VALUES_EQUAL("(raw all zeros)", s);
opaque->MutableAddr()->sa_data[10] = 17;
- TString t = ToString(*addr);
+ TString t = ToString(*addr);
UNIT_ASSERT_C(t.StartsWith("(raw 0 0"), t);
UNIT_ASSERT_C(t.EndsWith(')'), t);
@@ -25,8 +25,8 @@ Y_UNIT_TEST_SUITE(IRemoteAddr_ToString) {
TNetworkAddress::TIterator it = address.Begin();
UNIT_ASSERT(it != address.End());
UNIT_ASSERT(it->ai_family == AF_INET6);
- TString toString = ToString((const IRemoteAddr&)TAddrInfo(&*it));
- UNIT_ASSERT_VALUES_EQUAL(TString("[::1]:22"), toString);
+ TString toString = ToString((const IRemoteAddr&)TAddrInfo(&*it));
+ UNIT_ASSERT_VALUES_EQUAL(TString("[::1]:22"), toString);
}
Y_UNIT_TEST(Loopback) {
diff --git a/util/network/endpoint.cpp b/util/network/endpoint.cpp
index 3b1ee85c4a..9acdd06940 100644
--- a/util/network/endpoint.cpp
+++ b/util/network/endpoint.cpp
@@ -32,7 +32,7 @@ void TEndpoint::SetPort(ui16 port) {
}
}
-ui16 TEndpoint::Port() const noexcept {
+ui16 TEndpoint::Port() const noexcept {
if (Addr_->Addr()->sa_family == AF_UNIX) {
return 0;
}
diff --git a/util/network/endpoint.h b/util/network/endpoint.h
index abd58c15a0..a3e59b4925 100644
--- a/util/network/endpoint.h
+++ b/util/network/endpoint.h
@@ -12,7 +12,7 @@ public:
TEndpoint(const TAddrRef& addr);
TEndpoint();
- inline const TAddrRef& Addr() const noexcept {
+ inline const TAddrRef& Addr() const noexcept {
return Addr_;
}
inline const sockaddr* SockAddr() const {
@@ -32,12 +32,12 @@ public:
return Addr_->Addr()->sa_family == AF_UNIX;
}
- inline TString IpToString() const {
+ inline TString IpToString() const {
return NAddr::PrintHost(*Addr_);
}
void SetPort(ui16 port);
- ui16 Port() const noexcept;
+ ui16 Port() const noexcept;
size_t Hash() const;
diff --git a/util/network/endpoint_ut.cpp b/util/network/endpoint_ut.cpp
index 69117dd3d3..d5e40dd6e1 100644
--- a/util/network/endpoint_ut.cpp
+++ b/util/network/endpoint_ut.cpp
@@ -7,7 +7,7 @@
Y_UNIT_TEST_SUITE(TEndpointTest) {
Y_UNIT_TEST(TestSimple) {
- TVector<TNetworkAddress> addrs;
+ TVector<TNetworkAddress> addrs;
TEndpoint ep0;
@@ -64,7 +64,7 @@ Y_UNIT_TEST_SUITE(TEndpointTest) {
ep3_.SetPort(54321);
- THashSet<TEndpoint> he;
+ THashSet<TEndpoint> he;
he.insert(ep0);
he.insert(ep1);
@@ -87,8 +87,8 @@ Y_UNIT_TEST_SUITE(TEndpointTest) {
}
Y_UNIT_TEST(TestEqual) {
- const TString ip1 = "2a02:6b8:0:1410::5f6c:f3c2";
- const TString ip2 = "2a02:6b8:0:1410::5f6c:f3c3";
+ const TString ip1 = "2a02:6b8:0:1410::5f6c:f3c2";
+ const TString ip2 = "2a02:6b8:0:1410::5f6c:f3c3";
TNetworkAddress na1(ip1, 24242);
TEndpoint ep1(new NAddr::TAddrInfo(&*na1.Begin()));
diff --git a/util/network/interface.cpp b/util/network/interface.cpp
index c4652c3c28..256776c6d3 100644
--- a/util/network/interface.cpp
+++ b/util/network/interface.cpp
@@ -18,7 +18,7 @@ namespace NAddr {
TNetworkInterfaceList result;
#ifdef _win_
- TVector<char> buf;
+ TVector<char> buf;
buf.resize(1000000);
PIP_ADAPTER_ADDRESSES adapterBuf = (PIP_ADAPTER_ADDRESSES)&buf[0];
ULONG bufSize = buf.ysize();
diff --git a/util/network/interface.h b/util/network/interface.h
index c828144b08..dda4555021 100644
--- a/util/network/interface.h
+++ b/util/network/interface.h
@@ -6,12 +6,12 @@
namespace NAddr {
struct TNetworkInterface {
- TString Name;
+ TString Name;
IRemoteAddrRef Address;
IRemoteAddrRef Mask;
};
- using TNetworkInterfaceList = TVector<TNetworkInterface>;
+ using TNetworkInterfaceList = TVector<TNetworkInterface>;
TNetworkInterfaceList GetNetworkInterfaces();
}
diff --git a/util/network/iovec.h b/util/network/iovec.h
index 46b753cee8..ac15a41f54 100644
--- a/util/network/iovec.h
+++ b/util/network/iovec.h
@@ -14,7 +14,7 @@ public:
{
}
- inline void Proceed(size_t len) noexcept {
+ inline void Proceed(size_t len) noexcept {
while (Count_) {
if (len < Parts_->len) {
Parts_->len -= len;
@@ -33,15 +33,15 @@ public:
}
}
- inline const TPart* Parts() const noexcept {
+ inline const TPart* Parts() const noexcept {
return Parts_;
}
- inline size_t Count() const noexcept {
+ inline size_t Count() const noexcept {
return Count_;
}
- static inline size_t Bytes(const TPart* parts, size_t count) noexcept {
+ static inline size_t Bytes(const TPart* parts, size_t count) noexcept {
size_t ret = 0;
for (size_t i = 0; i < count; ++i) {
@@ -51,11 +51,11 @@ public:
return ret;
}
- inline size_t Bytes() const noexcept {
+ inline size_t Bytes() const noexcept {
return Bytes(Parts_, Count_);
}
- inline bool Complete() const noexcept {
+ inline bool Complete() const noexcept {
return !Count();
}
diff --git a/util/network/ip.h b/util/network/ip.h
index acaa1a9146..dc7c2d24a0 100644
--- a/util/network/ip.h
+++ b/util/network/ip.h
@@ -5,7 +5,7 @@
#include <util/system/error.h>
#include <util/system/byteorder.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/yexception.h>
/// IPv4 address in network format
@@ -36,15 +36,15 @@ static inline char* IpToString(TIpHost ip, char* buf, size_t len) {
return buf;
}
-static inline TString IpToString(TIpHost ip) {
+static inline TString IpToString(TIpHost ip) {
char buf[INET_ADDRSTRLEN];
- return TString(IpToString(ip, buf, sizeof(buf)));
+ return TString(IpToString(ip, buf, sizeof(buf)));
}
static inline TIpHost ResolveHost(const char* data, size_t len) {
TIpHost ret;
- const TString s(data, len);
+ const TString s(data, len);
if (NResolver::GetHostIP(s.data(), &ret) != 0) {
ythrow TSystemError(NResolver::GetDnsError()) << "can not resolve(" << s << ")";
@@ -55,17 +55,17 @@ static inline TIpHost ResolveHost(const char* data, size_t len) {
/// socket address
struct TIpAddress: public sockaddr_in {
- inline TIpAddress() noexcept {
+ inline TIpAddress() noexcept {
Clear();
}
- inline TIpAddress(const sockaddr_in& addr) noexcept
+ inline TIpAddress(const sockaddr_in& addr) noexcept
: sockaddr_in(addr)
, tmp(0)
{
}
- inline TIpAddress(TIpHost ip, TIpPort port) noexcept {
+ inline TIpAddress(TIpHost ip, TIpPort port) noexcept {
Set(ip, port);
}
@@ -77,27 +77,27 @@ struct TIpAddress: public sockaddr_in {
Set(ResolveHost(ip, strlen(ip)), port);
}
- inline operator sockaddr*() const noexcept {
+ inline operator sockaddr*() const noexcept {
return (sockaddr*)(sockaddr_in*)this;
}
- inline operator socklen_t*() const noexcept {
+ inline operator socklen_t*() const noexcept {
tmp = sizeof(sockaddr_in);
return (socklen_t*)&tmp;
}
- inline operator socklen_t() const noexcept {
+ inline operator socklen_t() const noexcept {
tmp = sizeof(sockaddr_in);
return tmp;
}
- inline void Clear() noexcept {
+ inline void Clear() noexcept {
Zero((sockaddr_in&)(*this));
}
- inline void Set(TIpHost ip, TIpPort port) noexcept {
+ inline void Set(TIpHost ip, TIpPort port) noexcept {
Clear();
sin_family = AF_INET;
@@ -105,11 +105,11 @@ struct TIpAddress: public sockaddr_in {
sin_port = HostToInet(port);
}
- inline TIpHost Host() const noexcept {
+ inline TIpHost Host() const noexcept {
return sin_addr.s_addr;
}
- inline TIpPort Port() const noexcept {
+ inline TIpPort Port() const noexcept {
return InetToHost(sin_port);
}
diff --git a/util/network/nonblock.cpp b/util/network/nonblock.cpp
index bee7ec539d..e515c27cc5 100644
--- a/util/network/nonblock.cpp
+++ b/util/network/nonblock.cpp
@@ -85,7 +85,7 @@ namespace {
return ret;
}
- static inline const TFeatureCheck* Instance() noexcept {
+ static inline const TFeatureCheck* Instance() noexcept {
return Singleton<TFeatureCheck>();
}
diff --git a/util/network/poller.h b/util/network/poller.h
index 28476bffc9..8dccd73140 100644
--- a/util/network/poller.h
+++ b/util/network/poller.h
@@ -8,7 +8,7 @@
class TSocketPoller {
public:
TSocketPoller();
- ~TSocketPoller();
+ ~TSocketPoller();
void WaitRead(SOCKET sock, void* cookie);
void WaitWrite(SOCKET sock, void* cookie);
diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h
index 196092cecd..e8c7e40fba 100644
--- a/util/network/pollerimpl.h
+++ b/util/network/pollerimpl.h
@@ -7,7 +7,7 @@
#include <util/system/defaults.h>
#include <util/generic/ylimits.h>
#include <util/generic/utility.h>
-#include <util/generic/vector.h>
+#include <util/generic/vector.h>
#include <util/generic/yexception.h>
#include <util/datetime/base.h>
@@ -40,7 +40,7 @@ enum EContPoll {
CONT_POLL_BACKLOG_EMPTY = 64, // Backlog is empty (seen end of request, EAGAIN or truncated read)
};
-static inline bool IsSocket(SOCKET fd) noexcept {
+static inline bool IsSocket(SOCKET fd) noexcept {
int val = 0;
socklen_t len = sizeof(val);
@@ -51,7 +51,7 @@ static inline bool IsSocket(SOCKET fd) noexcept {
return LastSystemError() != ENOTSOCK;
}
-static inline int MicroToMilli(int timeout) noexcept {
+static inline int MicroToMilli(int timeout) noexcept {
if (timeout) {
/*
* 1. API of epoll syscall allows to specify timeout with millisecond
@@ -74,7 +74,7 @@ struct TWithoutLocking {
#if defined(HAVE_KQUEUE_POLLER)
static inline int Kevent(int kq, struct kevent* changelist, int nchanges,
- struct kevent* eventlist, int nevents, const struct timespec* timeout) noexcept {
+ struct kevent* eventlist, int nevents, const struct timespec* timeout) noexcept {
int ret;
do {
@@ -97,11 +97,11 @@ public:
}
}
- inline ~TKqueuePoller() {
+ inline ~TKqueuePoller() {
close(Fd_);
}
- inline int Fd() const noexcept {
+ inline int Fd() const noexcept {
return Fd_;
}
@@ -131,7 +131,7 @@ public:
}
}
- inline void Remove(int fd) noexcept {
+ inline void Remove(int fd) noexcept {
TEvent e[2];
Zero(e);
@@ -142,7 +142,7 @@ public:
Y_VERIFY(!(Kevent(Fd_, e, 2, nullptr, 0, nullptr) == -1 && errno != ENOENT), "kevent remove failed: %s", LastSystemErrorText());
}
- inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept {
+ inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept {
struct timespec ts;
ts.tv_sec = timeout / 1000000;
@@ -155,11 +155,11 @@ public:
return (size_t)ret;
}
- static inline void* ExtractEvent(const TEvent* event) noexcept {
+ static inline void* ExtractEvent(const TEvent* event) noexcept {
return event->udata;
}
- static inline int ExtractStatus(const TEvent* event) noexcept {
+ static inline int ExtractStatus(const TEvent* event) noexcept {
if (event->flags & EV_ERROR) {
return EIO;
}
@@ -167,7 +167,7 @@ public:
return event->fflags;
}
- static inline int ExtractFilterImpl(const TEvent* event) noexcept {
+ static inline int ExtractFilterImpl(const TEvent* event) noexcept {
if (event->filter == EVFILT_READ) {
return CONT_POLL_READ;
}
@@ -189,7 +189,7 @@ private:
#endif
#if defined(HAVE_EPOLL_POLLER)
-static inline int ContEpollWait(int epfd, struct epoll_event* events, int maxevents, int timeout) noexcept {
+static inline int ContEpollWait(int epfd, struct epoll_event* events, int maxevents, int timeout) noexcept {
int ret;
do {
@@ -212,11 +212,11 @@ public:
}
}
- inline ~TEpollPoller() {
+ inline ~TEpollPoller() {
close(Fd_);
}
- inline int Fd() const noexcept {
+ inline int Fd() const noexcept {
return Fd_;
}
@@ -258,7 +258,7 @@ public:
}
}
- inline void Remove(int fd) noexcept {
+ inline void Remove(int fd) noexcept {
TEvent e;
Zero(e);
@@ -266,7 +266,7 @@ public:
epoll_ctl(Fd_, EPOLL_CTL_DEL, fd, &e);
}
- inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept {
+ inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept {
const int ret = ContEpollWait(Fd_, events, len, MicroToMilli(timeout));
Y_VERIFY(ret >= 0, "epoll wait error: %s", LastSystemErrorText());
@@ -274,11 +274,11 @@ public:
return (size_t)ret;
}
- static inline void* ExtractEvent(const TEvent* event) noexcept {
+ static inline void* ExtractEvent(const TEvent* event) noexcept {
return event->data.ptr;
}
- static inline int ExtractStatus(const TEvent* event) noexcept {
+ static inline int ExtractStatus(const TEvent* event) noexcept {
if (event->events & (EPOLLERR | EPOLLHUP)) {
return EIO;
}
@@ -286,7 +286,7 @@ public:
return 0;
}
- static inline int ExtractFilterImpl(const TEvent* event) noexcept {
+ static inline int ExtractFilterImpl(const TEvent* event) noexcept {
int ret = 0;
if (event->events & EPOLLIN) {
@@ -315,7 +315,7 @@ private:
#include "pair.h"
-static inline int ContSelect(int n, fd_set* r, fd_set* w, fd_set* e, struct timeval* t) noexcept {
+static inline int ContSelect(int n, fd_set* r, fd_set* w, fd_set* e, struct timeval* t) noexcept {
int ret;
do {
@@ -336,11 +336,11 @@ struct TSelectPollerNoTemplate {
{
}
- inline void* Data() const noexcept {
+ inline void* Data() const noexcept {
return Data_;
}
- inline void Set(void* d, int s) noexcept {
+ inline void Set(void* d, int s) noexcept {
Data_ = d;
Filter_ = s;
}
@@ -349,12 +349,12 @@ struct TSelectPollerNoTemplate {
Filter_ &= ~c;
}
- inline int Filter() const noexcept {
+ inline int Filter() const noexcept {
return Filter_;
}
};
- class TFds: public THashMap<SOCKET, THandle> {
+ class TFds: public THashMap<SOCKET, THandle> {
public:
inline void Set(SOCKET fd, void* data, int filter) {
(*this)[fd].Set(data, filter);
@@ -364,7 +364,7 @@ struct TSelectPollerNoTemplate {
erase(fd);
}
- inline SOCKET Build(fd_set* r, fd_set* w, fd_set* e) const noexcept {
+ inline SOCKET Build(fd_set* r, fd_set* w, fd_set* e) const noexcept {
SOCKET ret = 0;
for (const auto& it : *this) {
@@ -391,15 +391,15 @@ struct TSelectPollerNoTemplate {
};
struct TEvent: public THandle {
- inline int Status() const noexcept {
+ inline int Status() const noexcept {
return -Min(Filter(), 0);
}
- inline void Error(void* d, int err) noexcept {
+ inline void Error(void* d, int err) noexcept {
Set(d, -err);
}
- inline void Success(void* d, int what) noexcept {
+ inline void Success(void* d, int what) noexcept {
Set(d, what);
}
};
@@ -419,7 +419,7 @@ public:
SetNonBlock(SigSock());
}
- inline ~TSelectPoller() {
+ inline ~TSelectPoller() {
closesocket(Signal_[0]);
closesocket(Signal_[1]);
}
@@ -432,7 +432,7 @@ public:
Signal();
}
- inline void Remove(SOCKET fd) noexcept {
+ inline void Remove(SOCKET fd) noexcept {
with_lock (CommandLock_) {
Commands_.push_back(TCommand(fd, 0));
}
@@ -440,7 +440,7 @@ public:
Signal();
}
- inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept {
+ inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept {
auto guard = Guard(Lock_);
do {
@@ -472,7 +472,7 @@ public:
return SavedEvents_.Get();
}
- inline size_t WaitBase(TEvent* events, size_t len, int timeout) noexcept {
+ inline size_t WaitBase(TEvent* events, size_t len, int timeout) noexcept {
with_lock (CommandLock_) {
for (auto command = Commands_.begin(); command != Commands_.end(); ++command) {
if (command->Filter_ != 0) {
@@ -571,24 +571,24 @@ public:
return events - eventsStart;
}
- inline size_t EventNumberHint() const noexcept {
+ inline size_t EventNumberHint() const noexcept {
return sizeof(fd_set) * 8 * 2;
}
- static inline void* ExtractEvent(const TEvent* event) noexcept {
+ static inline void* ExtractEvent(const TEvent* event) noexcept {
return event->Data();
}
- static inline int ExtractStatus(const TEvent* event) noexcept {
+ static inline int ExtractStatus(const TEvent* event) noexcept {
return event->Status();
}
- static inline int ExtractFilterImpl(const TEvent* event) noexcept {
+ static inline int ExtractFilterImpl(const TEvent* event) noexcept {
return event->Filter();
}
private:
- inline void Signal() noexcept {
+ inline void Signal() noexcept {
char ch = 13;
send(SigSock(), &ch, 1, 0);
@@ -602,11 +602,11 @@ private:
}
}
- inline SOCKET WaitSock() const noexcept {
+ inline SOCKET WaitSock() const noexcept {
return Signal_[1];
}
- inline SOCKET SigSock() const noexcept {
+ inline SOCKET SigSock() const noexcept {
return Signal_[0];
}
@@ -638,13 +638,13 @@ private:
TEvent* End_;
TMyMutex CommandLock_;
- TVector<TCommand> Commands_;
+ TVector<TCommand> Commands_;
SOCKET Signal_[2];
};
#endif
-static inline TDuration PollStep(const TInstant& deadLine, const TInstant& now) noexcept {
+static inline TDuration PollStep(const TInstant& deadLine, const TInstant& now) noexcept {
if (deadLine < now) {
return TDuration::Zero();
}
@@ -667,7 +667,7 @@ public:
}
}
- static inline int ExtractFilter(const TEvent* event) noexcept {
+ static inline int ExtractFilter(const TEvent* event) noexcept {
if (TBase::ExtractStatus(event)) {
return CONT_POLL_READ | CONT_POLL_WRITE | CONT_POLL_RDHUP;
}
@@ -675,7 +675,7 @@ public:
return TBase::ExtractFilterImpl(event);
}
- inline size_t WaitD(TEvent* events, size_t len, TInstant deadLine, TInstant now = TInstant::Now()) noexcept {
+ inline size_t WaitD(TEvent* events, size_t len, TInstant deadLine, TInstant now = TInstant::Now()) noexcept {
if (!len) {
return 0;
}
diff --git a/util/network/sock.h b/util/network/sock.h
index b651ab6296..b10be2f715 100644
--- a/util/network/sock.h
+++ b/util/network/sock.h
@@ -30,7 +30,7 @@ struct ISockAddr {
virtual sockaddr* SockAddr() = 0;
virtual const sockaddr* SockAddr() const = 0;
// address in human readable form
- virtual TString ToString() const = 0;
+ virtual TString ToString() const = 0;
protected:
// below are the implemetation methods that can be called by T*Socket classes
@@ -64,12 +64,12 @@ struct TSockAddrLocal: public ISockAddr {
return Size();
}
- inline void Clear() noexcept {
+ inline void Clear() noexcept {
Zero(in);
Zero(Path);
}
- inline void Set(const char* path) noexcept {
+ inline void Set(const char* path) noexcept {
Clear();
in.sin_family = AF_INET;
in.sin_addr.s_addr = IpFromString("127.0.0.1");
@@ -85,8 +85,8 @@ struct TSockAddrLocal: public ISockAddr {
return (const struct sockaddr*)(&in);
}
- TString ToString() const {
- return TString(Path);
+ TString ToString() const {
+ return TString(Path);
}
TFsPath ToPath() const {
@@ -160,11 +160,11 @@ struct TSockAddrLocal: public sockaddr_un, public ISockAddr {
return strlen(sun_path) + 2;
}
- inline void Clear() noexcept {
+ inline void Clear() noexcept {
Zero(*(sockaddr_un*)this);
}
- inline void Set(const char* path) noexcept {
+ inline void Set(const char* path) noexcept {
Clear();
sun_family = AF_UNIX;
strlcpy(sun_path, path, sizeof(sun_path));
@@ -178,8 +178,8 @@ struct TSockAddrLocal: public sockaddr_un, public ISockAddr {
return (const struct sockaddr*)(const struct sockaddr_un*)this;
}
- TString ToString() const override {
- return TString(sun_path);
+ TString ToString() const override {
+ return TString(sun_path);
}
TFsPath ToPath() const {
@@ -222,11 +222,11 @@ struct TSockAddrInet: public sockaddr_in, public ISockAddr {
return Size();
}
- inline void Clear() noexcept {
+ inline void Clear() noexcept {
Zero(*(sockaddr_in*)this);
}
- inline void Set(TIpHost ip, TIpPort port) noexcept {
+ inline void Set(TIpHost ip, TIpPort port) noexcept {
Clear();
sin_family = AF_INET;
sin_addr.s_addr = ip;
@@ -241,7 +241,7 @@ struct TSockAddrInet: public sockaddr_in, public ISockAddr {
return (const struct sockaddr*)(const struct sockaddr_in*)this;
}
- TString ToString() const override {
+ TString ToString() const override {
return IpToString(sin_addr.s_addr) + ":" + ::ToString(InetToHost(sin_port));
}
@@ -258,11 +258,11 @@ struct TSockAddrInet: public sockaddr_in, public ISockAddr {
return 0;
}
- TIpHost GetIp() const noexcept {
+ TIpHost GetIp() const noexcept {
return sin_addr.s_addr;
}
- TIpPort GetPort() const noexcept {
+ TIpPort GetPort() const noexcept {
return InetToHost(sin_port);
}
@@ -288,11 +288,11 @@ struct TSockAddrInet6: public sockaddr_in6, public ISockAddr {
return Size();
}
- inline void Clear() noexcept {
+ inline void Clear() noexcept {
Zero(*(sockaddr_in6*)this);
}
- inline void Set(const char* ip6, const TIpPort port) noexcept {
+ inline void Set(const char* ip6, const TIpPort port) noexcept {
Clear();
sin6_family = AF_INET6;
inet_pton(AF_INET6, ip6, &sin6_addr);
@@ -307,7 +307,7 @@ struct TSockAddrInet6: public sockaddr_in6, public ISockAddr {
return (const struct sockaddr*)(const struct sockaddr_in6*)this;
}
- TString ToString() const override {
+ TString ToString() const override {
return "[" + GetIp() + "]:" + ::ToString(InetToHost(sin6_port));
}
@@ -324,13 +324,13 @@ struct TSockAddrInet6: public sockaddr_in6, public ISockAddr {
return 0;
}
- TString GetIp() const noexcept {
+ TString GetIp() const noexcept {
char ip6[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, (void*)&sin6_addr, ip6, INET6_ADDRSTRLEN);
- return TString(ip6);
+ return TString(ip6);
}
- TIpPort GetPort() const noexcept {
+ TIpPort GetPort() const noexcept {
return InetToHost(sin6_port);
}
@@ -583,9 +583,9 @@ public:
Socket = socket;
}
- TStreamSocketOutput(TStreamSocketOutput&&) noexcept = default;
- TStreamSocketOutput& operator=(TStreamSocketOutput&&) noexcept = default;
-
+ TStreamSocketOutput(TStreamSocketOutput&&) noexcept = default;
+ TStreamSocketOutput& operator=(TStreamSocketOutput&&) noexcept = default;
+
protected:
TStreamSocket* Socket;
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 7f117a47b7..4f6e804346 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -103,7 +103,7 @@ static const evpair evpairs_to_unix[] = {
static const size_t nevpairs_to_unix = sizeof(evpairs_to_unix) / sizeof(evpairs_to_unix[0]);
-static int convert_events(int events, const evpair* evpairs, size_t nevpairs, bool ignoreUnknown) noexcept {
+static int convert_events(int events, const evpair* evpairs, size_t nevpairs, bool ignoreUnknown) noexcept {
int result = 0;
for (size_t i = 0; i < nevpairs; ++i) {
int event = evpairs[i].event;
@@ -127,21 +127,21 @@ private:
HANDLE Event;
public:
- inline TWSAEventHolder(HANDLE event) noexcept
+ inline TWSAEventHolder(HANDLE event) noexcept
: Event(event)
{
}
- inline ~TWSAEventHolder() {
+ inline ~TWSAEventHolder() {
WSACloseEvent(Event);
}
- inline HANDLE Get() noexcept {
+ inline HANDLE Get() noexcept {
return Event;
}
};
-int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept {
+int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept {
HANDLE rawEvent = WSACreateEvent();
if (rawEvent == WSA_INVALID_EVENT) {
errno = EIO;
@@ -553,7 +553,7 @@ static ssize_t DoSendMsg(SOCKET sock, const struct iovec* iov, int iovcnt) {
}
#endif
-void TSocketHolder::Close() noexcept {
+void TSocketHolder::Close() noexcept {
if (Fd_ != INVALID_SOCKET) {
bool ok = (closesocket(Fd_) == 0);
if (!ok) {
@@ -585,7 +585,7 @@ public:
inline ~TImpl() = default;
- inline SOCKET Fd() const noexcept {
+ inline SOCKET Fd() const noexcept {
return Fd_;
}
@@ -752,7 +752,7 @@ class TCommonSockOps: public TSocket::TOps {
using TPart = TSocket::TPart;
public:
- inline TCommonSockOps() noexcept {
+ inline TCommonSockOps() noexcept {
}
~TCommonSockOps() override = default;
@@ -832,7 +832,7 @@ ssize_t TCommonSockOps::SendVPartial(SOCKET fd, const TPart* constParts, size_t
return written;
}
-static inline TSocket::TOps* GetCommonSockOps() noexcept {
+static inline TSocket::TOps* GetCommonSockOps() noexcept {
return Singleton<TCommonSockOps>();
}
@@ -868,7 +868,7 @@ TSocket::TSocket(const TNetworkAddress& addr, const TInstant& deadLine)
TSocket::~TSocket() = default;
-SOCKET TSocket::Fd() const noexcept {
+SOCKET TSocket::Fd() const noexcept {
return Impl_->Fd();
}
@@ -888,7 +888,7 @@ void TSocket::Close() {
Impl_->Close();
}
-TSocketInput::TSocketInput(const TSocket& s) noexcept
+TSocketInput::TSocketInput(const TSocket& s) noexcept
: S_(s)
{
}
@@ -905,12 +905,12 @@ size_t TSocketInput::DoRead(void* buf, size_t len) {
ythrow TSystemError(-(int)ret) << "can not read from socket input stream";
}
-TSocketOutput::TSocketOutput(const TSocket& s) noexcept
+TSocketOutput::TSocketOutput(const TSocket& s) noexcept
: S_(s)
{
}
-TSocketOutput::~TSocketOutput() {
+TSocketOutput::~TSocketOutput() {
try {
Finish();
} catch (...) {
@@ -947,7 +947,7 @@ void TSocketOutput::DoWriteV(const TPart* parts, size_t count) {
namespace {
//https://bugzilla.mozilla.org/attachment.cgi?id=503263&action=diff
- struct TLocalNames: public THashSet<TStringBuf> {
+ struct TLocalNames: public THashSet<TStringBuf> {
inline TLocalNames() {
insert("localhost");
insert("localhost.localdomain");
@@ -1004,7 +1004,7 @@ public:
inline TImpl(const char* host, ui16 port, int flags)
: Info_(nullptr, TAddrInfoDeleter{})
{
- const TString port_st(ToString(port));
+ const TString port_st(ToString(port));
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
@@ -1054,7 +1054,7 @@ public:
Info_.reset(hints.release());
}
- inline struct addrinfo* Info() const noexcept {
+ inline struct addrinfo* Info() const noexcept {
return Info_.get();
}
@@ -1069,12 +1069,12 @@ TNetworkAddress::TNetworkAddress(const TUnixSocketPath& unixSocketPath, int flag
{
}
-TNetworkAddress::TNetworkAddress(const TString& host, ui16 port, int flags)
+TNetworkAddress::TNetworkAddress(const TString& host, ui16 port, int flags)
: Impl_(new TImpl(host.data(), port, flags))
{
}
-TNetworkAddress::TNetworkAddress(const TString& host, ui16 port)
+TNetworkAddress::TNetworkAddress(const TString& host, ui16 port)
: Impl_(new TImpl(host.data(), port, 0))
{
}
@@ -1086,7 +1086,7 @@ TNetworkAddress::TNetworkAddress(ui16 port)
TNetworkAddress::~TNetworkAddress() = default;
-struct addrinfo* TNetworkAddress::Info() const noexcept {
+struct addrinfo* TNetworkAddress::Info() const noexcept {
return Impl_->Info();
}
@@ -1227,7 +1227,7 @@ void SetDeferAccept(SOCKET s) {
#endif
}
-ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept {
+ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept {
TInstant now = TInstant::Now();
do {
diff --git a/util/network/socket.h b/util/network/socket.h
index e19b77a5b6..40c8648b40 100644
--- a/util/network/socket.h
+++ b/util/network/socket.h
@@ -42,7 +42,7 @@ struct pollfd {
#define POLLNVAL (1 << 9)
const char* inet_ntop(int af, const void* src, char* dst, socklen_t size);
-int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept;
+int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept;
#else
#define poll(fds, nfds, timeout) WSAPoll(fds, nfds, timeout)
#endif
@@ -59,12 +59,12 @@ int inet_aton(const char* cp, struct in_addr* inp);
#endif
template <class T>
-static inline int SetSockOpt(SOCKET s, int level, int optname, T opt) noexcept {
+static inline int SetSockOpt(SOCKET s, int level, int optname, T opt) noexcept {
return setsockopt(s, level, optname, (const char*)&opt, sizeof(opt));
}
template <class T>
-static inline int GetSockOpt(SOCKET s, int level, int optname, T& opt) noexcept {
+static inline int GetSockOpt(SOCKET s, int level, int optname, T& opt) noexcept {
socklen_t len = sizeof(opt);
return getsockopt(s, level, optname, (char*)&opt, &len);
@@ -174,11 +174,11 @@ public:
{
}
- inline void Next() noexcept {
+ inline void Next() noexcept {
C_ = C_->ai_next;
}
- inline TIterator operator++(int) noexcept {
+ inline TIterator operator++(int) noexcept {
TIterator old(*this);
Next();
@@ -186,25 +186,25 @@ public:
return old;
}
- inline TIterator& operator++() noexcept {
+ inline TIterator& operator++() noexcept {
Next();
return *this;
}
- friend inline bool operator==(const TIterator& l, const TIterator& r) noexcept {
+ friend inline bool operator==(const TIterator& l, const TIterator& r) noexcept {
return l.C_ == r.C_;
}
- friend inline bool operator!=(const TIterator& l, const TIterator& r) noexcept {
+ friend inline bool operator!=(const TIterator& l, const TIterator& r) noexcept {
return !(l == r);
}
- inline struct addrinfo& operator*() const noexcept {
+ inline struct addrinfo& operator*() const noexcept {
return *C_;
}
- inline struct addrinfo* operator->() const noexcept {
+ inline struct addrinfo* operator->() const noexcept {
return C_;
}
@@ -213,21 +213,21 @@ public:
};
TNetworkAddress(ui16 port);
- TNetworkAddress(const TString& host, ui16 port);
- TNetworkAddress(const TString& host, ui16 port, int flags);
+ TNetworkAddress(const TString& host, ui16 port);
+ TNetworkAddress(const TString& host, ui16 port, int flags);
TNetworkAddress(const TUnixSocketPath& unixSocketPath, int flags = 0);
- ~TNetworkAddress();
+ ~TNetworkAddress();
- inline TIterator Begin() const noexcept {
+ inline TIterator Begin() const noexcept {
return TIterator(Info());
}
- inline TIterator End() const noexcept {
+ inline TIterator End() const noexcept {
return TIterator(nullptr);
}
private:
- struct addrinfo* Info() const noexcept;
+ struct addrinfo* Info() const noexcept;
private:
class TImpl;
@@ -260,31 +260,31 @@ public:
return *this;
}
- inline ~TSocketHolder() {
+ inline ~TSocketHolder() {
Close();
}
- inline SOCKET Release() noexcept {
+ inline SOCKET Release() noexcept {
SOCKET ret = Fd_;
Fd_ = INVALID_SOCKET;
return ret;
}
- void Close() noexcept;
+ void Close() noexcept;
inline void ShutDown(int mode) const {
::ShutDown(Fd_, mode);
}
- inline void Swap(TSocketHolder& r) noexcept {
+ inline void Swap(TSocketHolder& r) noexcept {
DoSwap(Fd_, r.Fd_);
}
- inline bool Closed() const noexcept {
+ inline bool Closed() const noexcept {
return Fd_ == INVALID_SOCKET;
}
- inline operator SOCKET() const noexcept {
+ inline operator SOCKET() const noexcept {
return Fd_;
}
@@ -316,7 +316,7 @@ public:
TSocket(const TNetworkAddress& addr, const TDuration& timeOut);
TSocket(const TNetworkAddress& addr, const TInstant& deadLine);
- ~TSocket();
+ ~TSocket();
template <class T>
inline void SetSockOpt(int level, int optname, T opt) {
@@ -377,12 +377,12 @@ public:
*/
ssize_t SendV(const TPart* parts, size_t count);
- inline operator SOCKET() const noexcept {
+ inline operator SOCKET() const noexcept {
return Fd();
}
private:
- SOCKET Fd() const noexcept;
+ SOCKET Fd() const noexcept;
private:
class TImpl;
@@ -391,13 +391,13 @@ private:
class TSocketInput: public IInputStream {
public:
- TSocketInput(const TSocket& s) noexcept;
- ~TSocketInput() override;
+ TSocketInput(const TSocket& s) noexcept;
+ ~TSocketInput() override;
- TSocketInput(TSocketInput&&) noexcept = default;
- TSocketInput& operator=(TSocketInput&&) noexcept = default;
-
- const TSocket& GetSocket() const noexcept {
+ TSocketInput(TSocketInput&&) noexcept = default;
+ TSocketInput& operator=(TSocketInput&&) noexcept = default;
+
+ const TSocket& GetSocket() const noexcept {
return S_;
}
@@ -410,13 +410,13 @@ private:
class TSocketOutput: public IOutputStream {
public:
- TSocketOutput(const TSocket& s) noexcept;
- ~TSocketOutput() override;
+ TSocketOutput(const TSocket& s) noexcept;
+ ~TSocketOutput() override;
+
+ TSocketOutput(TSocketOutput&&) noexcept = default;
+ TSocketOutput& operator=(TSocketOutput&&) noexcept = default;
- TSocketOutput(TSocketOutput&&) noexcept = default;
- TSocketOutput& operator=(TSocketOutput&&) noexcept = default;
-
- const TSocket& GetSocket() const noexcept {
+ const TSocket& GetSocket() const noexcept {
return S_;
}
@@ -429,4 +429,4 @@ private:
};
//return -(error code) if error occured, or number of ready fds
-ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept;
+ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept;
diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp
index 6d700ac8af..6b20e11f70 100644
--- a/util/network/socket_ut.cpp
+++ b/util/network/socket_ut.cpp
@@ -63,7 +63,7 @@ void TSockTest::TestTimeout() {
}
int realTimeout = (int)(millisec() - startTime);
if (realTimeout > timeout + 2000) {
- TString err = TStringBuilder() << "Timeout exceeded: " << realTimeout << " ms (expected " << timeout << " ms)";
+ TString err = TStringBuilder() << "Timeout exceeded: " << realTimeout << " ms (expected " << timeout << " ms)";
UNIT_FAIL(err);
}
}
@@ -74,7 +74,7 @@ void TSockTest::TestConnectionRefused() {
}
void TSockTest::TestNetworkResolutionError() {
- TString errMsg;
+ TString errMsg;
try {
TNetworkAddress addr("", 0);
} catch (const TNetworkResolutionError& e) {
@@ -86,8 +86,8 @@ void TSockTest::TestNetworkResolutionError() {
}
int expectedErr = EAI_NONAME;
- TString expectedErrMsg = gai_strerror(expectedErr);
- if (errMsg.find(expectedErrMsg) == TString::npos) {
+ TString expectedErrMsg = gai_strerror(expectedErr);
+ if (errMsg.find(expectedErrMsg) == TString::npos) {
UNIT_FAIL("TNetworkResolutionError contains\nInvalid msg: " + errMsg + "\nExpected msg: " + expectedErrMsg + "\n");
}
}
@@ -289,9 +289,9 @@ void TPollTest::TestPollInOut() {
ui32 localIp = ntohl(inet_addr("127.0.0.1"));
- TVector<TSimpleSharedPtr<TSocketHolder>> clientSockets;
- TVector<TSimpleSharedPtr<TSocketHolder>> connectedSockets;
- TVector<pollfd> fds;
+ TVector<TSimpleSharedPtr<TSocketHolder>> clientSockets;
+ TVector<TSimpleSharedPtr<TSocketHolder>> connectedSockets;
+ TVector<pollfd> fds;
for (size_t i = 0; i < socketCount; ++i) {
TSimpleSharedPtr<TSocketHolder> clientSocket(new TSocketHolder(StartClientSocket(localIp, port)));