MCPcopy Create free account
hub / github.com/catboost/catboost / SetPort

Method SetPort

util/network/endpoint.cpp:19–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void TEndpoint::SetPort(ui16 port) {
20 if (Port() == port || Addr_->Addr()->sa_family == AF_UNIX) {
21 return;
22 }
23
24 NAddr::TOpaqueAddr* oa = new NAddr::TOpaqueAddr(Addr_.Get());
25 Addr_.Reset(oa);
26 sockaddr* sa = oa->MutableAddr();
27
28 if (sa->sa_family == AF_INET) {
29 ((sockaddr_in*)sa)->sin_port = HostToInet(port);
30 } else {
31 ((sockaddr_in6*)sa)->sin6_port = HostToInet(port);
32 }
33}
34
35ui16 TEndpoint::Port() const noexcept {
36 if (Addr_->Addr()->sa_family == AF_UNIX) {

Callers 1

Y_UNIT_TESTFunction · 0.45

Calls 5

HostToInetFunction · 0.85
MutableAddrMethod · 0.80
AddrMethod · 0.45
GetMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected