Skip to content

Commit 6476c08

Browse files
committed
Fix socket address getter
1 parent 68496f8 commit 6476c08

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

toolbelt/sockets.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class InetAddress {
9999
in_addr IpAddress() const { return {ntohl(addr_.sin_addr.s_addr)}; }
100100
int Port() const { return ntohs(addr_.sin_port); }
101101

102+
in_addr IpAddressInNetworkOrder() const { return {addr_.sin_addr.s_addr}; }
103+
102104
// Port is in host byte order.
103105
void SetPort(int port) { addr_.sin_port = htons(port); }
104106

@@ -239,7 +241,7 @@ class SocketAddress {
239241
return std::visit(
240242
EyeOfNewt{
241243
[](const InetAddress &a) {
242-
return SocketAddress(a.IpAddress(), 0);
244+
return SocketAddress(a.IpAddressInNetworkOrder(), 0);
243245
},
244246
[](const VirtualAddress &a) { return SocketAddress(a.Cid(), 0); },
245247
[](const std::string &a) { return SocketAddress(a); }},

0 commit comments

Comments
 (0)