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

Function GetSendAddr

library/cpp/neh/udp.cpp:56–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 };
55
56 static inline IRemoteAddrPtr GetSendAddr(SOCKET s) {
57 IRemoteAddrPtr local = GetSockAddr(s);
58 const sockaddr* addr = local->Addr();
59
60 switch (addr->sa_family) {
61 case AF_INET: {
62 const TIpAddress a = *(const sockaddr_in*)addr;
63
64 return MakeHolder<TIPv4Addr>(TIpAddress(InetToHost(INADDR_LOOPBACK), a.Port()));
65 }
66
67 case AF_INET6: {
68 sockaddr_in6 a = *(const sockaddr_in6*)addr;
69
70 a.sin6_addr = in6addr_loopback;
71
72 return MakeHolder<TIPv6Addr>(a);
73 }
74 }
75
76 ythrow yexception() << "unsupported";
77 }
78
79 typedef ui32 TCheckSum;
80

Callers 1

~TProtoMethod · 0.85

Calls 4

InetToHostFunction · 0.85
TIpAddressClass · 0.50
AddrMethod · 0.45
PortMethod · 0.45

Tested by

no test coverage detected