diff options
Diffstat (limited to 'src/options.cpp')
-rw-r--r-- | src/options.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/options.cpp b/src/options.cpp index 29cf023..80ab294 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -39,6 +39,8 @@ zmq::options_t::options_t () : backlog (100), maxmsgsize (-1), filter (1), + rcvtimeo (-1), + sndtimeo (-1), immediate_connect (true) { } @@ -182,6 +184,22 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, filter = *((int*) optval_); return 0; + case ZMQ_RCVTIMEO: + if (optvallen_ != sizeof (int)) { + errno = EINVAL; + return -1; + } + rcvtimeo = *((int*) optval_); + return 0; + + case ZMQ_SNDTIMEO: + if (optvallen_ != sizeof (int)) { + errno = EINVAL; + return -1; + } + sndtimeo = *((int*) optval_); + return 0; + } errno = EINVAL; @@ -336,6 +354,24 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) *optvallen_ = sizeof (int); return 0; + case ZMQ_RCVTIMEO: + if (*optvallen_ < sizeof (int)) { + errno = EINVAL; + return -1; + } + *((int*) optval_) = rcvtimeo; + *optvallen_ = sizeof (int); + return 0; + + case ZMQ_SNDTIMEO: + if (*optvallen_ < sizeof (int)) { + errno = EINVAL; + return -1; + } + *((int*) optval_) = sndtimeo; + *optvallen_ = sizeof (int); + return 0; + } errno = EINVAL; |