Adding ZMQ_LAST_ENDPOINT for wildcard support on TCP and IPC sockets

This commit is contained in:
Ian Barber
2012-02-08 22:06:46 +00:00
parent 7e8a839a22
commit 7b32c9cb51
9 changed files with 99 additions and 7 deletions

View File

@@ -30,6 +30,7 @@ zmq::options_t::options_t () :
rcvhwm (1000),
affinity (0),
identity_size (0),
last_endpoint_size(0),
rate (100),
recovery_ivl (10000),
multicast_hops (1),
@@ -213,7 +214,6 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
ipv4only = val;
return 0;
}
}
errno = EINVAL;
@@ -385,7 +385,15 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*((int*) optval_) = ipv4only;
*optvallen_ = sizeof (int);
return 0;
case ZMQ_LAST_ENDPOINT:
if (*optvallen_ < last_endpoint_size) {
errno = EINVAL;
return -1;
}
memcpy (optval_, last_endpoint, last_endpoint_size);
*optvallen_ = last_endpoint_size;
return 0;
}
errno = EINVAL;