summaryrefslogtreecommitdiff
path: root/src/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.cpp')
-rw-r--r--src/options.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/options.cpp b/src/options.cpp
index e644a9b..c9e330f 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -34,6 +34,7 @@ zmq::options_t::options_t () :
sndbuf (0),
rcvbuf (0),
type (-1),
+ linger (-1),
requires_in (false),
requires_out (false),
immediate_connect (true)
@@ -128,6 +129,14 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
}
rcvbuf = *((uint64_t*) optval_);
return 0;
+
+ case ZMQ_LINGER:
+ if (optvallen_ != sizeof (int)) {
+ errno = EINVAL;
+ return -1;
+ }
+ linger = *((int*) optval_);
+ return 0;
}
errno = EINVAL;
@@ -138,6 +147,15 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
{
switch (option_) {
+ case ZMQ_LINGER:
+ if (*optvallen_ < sizeof (int)) {
+ errno = EINVAL;
+ return -1;
+ }
+ *((int*) optval_) = linger;
+ *optvallen_ = sizeof (int);
+ return 0;
+
case ZMQ_TYPE:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;