Resolve addresses in the calling thread on connect.

This allows us to actually report an error to the caller on resolve
failure, rather than asserting later on in the io thread.

Signed-off-by: Staffan Gimåker <staffan@spotify.com>
This commit is contained in:
Staffan Gimåker
2012-02-02 14:56:51 +01:00
parent b2e2fa622d
commit b9fb48f47b
40 changed files with 292 additions and 130 deletions

View File

@@ -419,12 +419,12 @@ int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv4only_)
return 0;
}
sockaddr *zmq::tcp_address_t::addr ()
const sockaddr *zmq::tcp_address_t::addr () const
{
return &address.generic;
}
socklen_t zmq::tcp_address_t::addrlen ()
socklen_t zmq::tcp_address_t::addrlen () const
{
if (address.generic.sa_family == AF_INET6)
return (socklen_t) sizeof (address.ipv6);
@@ -433,9 +433,9 @@ socklen_t zmq::tcp_address_t::addrlen ()
}
#if defined ZMQ_HAVE_WINDOWS
unsigned short zmq::tcp_address_t::family ()
unsigned short zmq::tcp_address_t::family () const
#else
sa_family_t zmq::tcp_address_t::family ()
sa_family_t zmq::tcp_address_t::family () const
#endif
{
return address.generic.sa_family;