Commit 38e5f869 authored by Paul Colomiets's avatar Paul Colomiets Committed by Martin Sustrik

Better handling of memory error in resolve_ip_hostname

Signed-off-by: 's avatarPaul Colomiets <pc@gafol.net>
parent 864c18f7
...@@ -301,7 +301,16 @@ int zmq::resolve_ip_hostname (sockaddr_storage *addr_, socklen_t *addr_len_, ...@@ -301,7 +301,16 @@ int zmq::resolve_ip_hostname (sockaddr_storage *addr_, socklen_t *addr_len_,
addrinfo *res; addrinfo *res;
int rc = getaddrinfo (hostname.c_str (), service.c_str (), &req, &res); int rc = getaddrinfo (hostname.c_str (), service.c_str (), &req, &res);
if (rc) { if (rc) {
switch (rc) {
case EAI_MEMORY:
errno = ENOMEM;
break;
default:
errno = EINVAL; errno = EINVAL;
break;
}
return -1; return -1;
} }
......
...@@ -45,7 +45,7 @@ zmq::zmq_connecter_t::zmq_connecter_t (class io_thread_t *io_thread_, ...@@ -45,7 +45,7 @@ zmq::zmq_connecter_t::zmq_connecter_t (class io_thread_t *io_thread_,
current_reconnect_ivl(options.reconnect_ivl) current_reconnect_ivl(options.reconnect_ivl)
{ {
int rc = tcp_connecter.set_address (protocol_, address_); int rc = tcp_connecter.set_address (protocol_, address_);
zmq_assert (rc == 0); zmq_assert (rc == 0); //TODO: take care ENOMEM, EINVAL
} }
zmq::zmq_connecter_t::~zmq_connecter_t () zmq::zmq_connecter_t::~zmq_connecter_t ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment