mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-30 21:50:49 +01:00
Disable sending messages on SUB socket
The ability was inherited from XSUB socket. Now it's properly disabled. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
15
src/sub.cpp
15
src/sub.cpp
@@ -51,7 +51,7 @@ int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
|
|||||||
|
|
||||||
// Pass it further on in the stack.
|
// Pass it further on in the stack.
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int rc = xsend (&msg, 0);
|
int rc = xsub_t::xsend (&msg, 0);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
err = errno;
|
err = errno;
|
||||||
zmq_msg_close (&msg);
|
zmq_msg_close (&msg);
|
||||||
@@ -59,3 +59,16 @@ int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
|
|||||||
errno = err;
|
errno = err;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int zmq::sub_t::xsend (zmq_msg_t *msg_, int options_)
|
||||||
|
{
|
||||||
|
// Overload the XSUB's send.
|
||||||
|
errno = ENOTSUP;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool zmq::sub_t::xhas_out ()
|
||||||
|
{
|
||||||
|
// Overload the XSUB's send.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ namespace zmq
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
|
int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
|
||||||
|
int xsend (zmq_msg_t *msg_, int options_);
|
||||||
|
bool xhas_out ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user