Summary: With WinSock, calling `getsockname` on a socket before it's been bound will always result in an error, so make sure to bind the socket first.
Reviewed By: yfeldblum
Differential Revision:
D3698112
fbshipit-source-id:
e9efe05323b242add3808ee1a6fec2593beb04ac
&v6only, sizeof(v6only)));
}
&v6only, sizeof(v6only)));
}
- SocketAddress address;
- address.setFromLocalAddress(s);
-
- sockets_.emplace_back(eventBase_, s, this, address.getFamily());
-
// Bind to the socket
if (fsp::bind(s, res->ai_addr, res->ai_addrlen) != 0) {
folly::throwSystemError(
// Bind to the socket
if (fsp::bind(s, res->ai_addr, res->ai_addrlen) != 0) {
folly::throwSystemError(
" family ",
SocketAddress::getFamilyNameFrom(res->ai_addr, "<unknown>"));
}
" family ",
SocketAddress::getFamilyNameFrom(res->ai_addr, "<unknown>"));
}
+
+ SocketAddress address;
+ address.setFromLocalAddress(s);
+
+ sockets_.emplace_back(eventBase_, s, this, address.getFamily());
};
const int kNumTries = 25;
};
const int kNumTries = 25;