| 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 |
no test coverage detected