mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-09 23:36:04 +00:00
Merge pull request #1487 from pijyoi/stream_notify
don't break STREAM socket ABI from 4.1.x to 4.2.0
This commit is contained in:
commit
7701a8f936
@ -716,16 +716,16 @@ Default value:: -1 (infinite)
|
||||
Applicable socket types:: all
|
||||
|
||||
|
||||
ZMQ_STREAM_NOTIFY: send connect notifications
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Enables connect notifications on a STREAM socket, when set to 1. By default a
|
||||
STREAM socket does not notify new connections. When notifications are enabled,
|
||||
it delivers a zero-length message to signal new client connections.
|
||||
ZMQ_STREAM_NOTIFY: send connect and disconnect notifications
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Enables connect and disconnect notifications on a STREAM socket, when set
|
||||
to 1. When notifications are enabled, the socket delivers a zero-length
|
||||
message when a peer connects or disconnects.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: int
|
||||
Option value unit:: 0, 1
|
||||
Default value:: 0
|
||||
Default value:: 1
|
||||
Applicable socket types:: ZMQ_STREAM
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ zmq::options_t::options_t () :
|
||||
invert_matching(false),
|
||||
recv_identity (false),
|
||||
raw_socket (false),
|
||||
raw_notify (false),
|
||||
raw_notify (true),
|
||||
tcp_keepalive (-1),
|
||||
tcp_keepalive_cnt (-1),
|
||||
tcp_keepalive_idle (-1),
|
||||
|
@ -965,7 +965,7 @@ int zmq::stream_engine_t::write_subscription_msg (msg_t *msg_)
|
||||
|
||||
void zmq::stream_engine_t::error (error_reason_t reason)
|
||||
{
|
||||
if (options.raw_socket) {
|
||||
if (options.raw_socket && options.raw_notify) {
|
||||
// For raw sockets, send a final 0-length message to the application
|
||||
// so that it knows the peer has been disconnected.
|
||||
msg_t terminator;
|
||||
|
@ -36,12 +36,15 @@ void test_stream_2_stream(){
|
||||
char buff[256];
|
||||
char msg[] = "hi 1";
|
||||
const char *bindip = "tcp://127.0.0.1:5556";
|
||||
int disabled = 0;
|
||||
int zero = 0;
|
||||
void *ctx = zmq_ctx_new ();
|
||||
|
||||
// Set up listener STREAM.
|
||||
rbind = zmq_socket (ctx, ZMQ_STREAM);
|
||||
assert (rbind);
|
||||
ret = zmq_setsockopt (rbind, ZMQ_STREAM_NOTIFY, &disabled, sizeof (disabled));
|
||||
assert (ret == 0);
|
||||
ret = zmq_setsockopt (rbind, ZMQ_LINGER, &zero, sizeof (zero));
|
||||
assert (0 == ret);
|
||||
ret = zmq_bind (rbind, bindip);
|
||||
|
Loading…
x
Reference in New Issue
Block a user