mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-27 11:06:52 +01:00
Problem: commit afb24b53 broke ZMQ_STREAM contract
Symptom is that ZMQ_STREAM sockets in 4.1.0 and 4.1.1 generate zero sized messages on each new connection, unlike 4.0.x which did not do this. Person who made this commit also changed test cases so that contract breakage did not show. Same person was later banned for persistently poor form in CZMQ contributions. Solution: enable connect notifications on ZMQ_STREAM sockets using a new ZMQ_STREAM_NOTIFY setting. By default, socket does not deliver notifications, and behaves as in 4.0.x. Fixes #1316
This commit is contained in:
@@ -33,14 +33,14 @@ zmq::router_t::router_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
|
||||
more_out (false),
|
||||
next_rid (generate_random ()),
|
||||
mandatory (false),
|
||||
// raw_sock functionality in ROUTER is deprecated
|
||||
raw_sock (false),
|
||||
// raw_socket functionality in ROUTER is deprecated
|
||||
raw_socket (false),
|
||||
probe_router (false),
|
||||
handover (false)
|
||||
{
|
||||
options.type = ZMQ_ROUTER;
|
||||
options.recv_identity = true;
|
||||
options.raw_sock = false;
|
||||
options.raw_socket = false;
|
||||
|
||||
prefetched_id.init ();
|
||||
prefetched_msg.init ();
|
||||
@@ -96,10 +96,10 @@ int zmq::router_t::xsetsockopt (int option_, const void *optval_,
|
||||
break;
|
||||
case ZMQ_ROUTER_RAW:
|
||||
if (is_int && value >= 0) {
|
||||
raw_sock = (value != 0);
|
||||
if (raw_sock) {
|
||||
raw_socket = (value != 0);
|
||||
if (raw_socket) {
|
||||
options.recv_identity = false;
|
||||
options.raw_sock = true;
|
||||
options.raw_socket = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ int zmq::router_t::xsend (msg_t *msg_)
|
||||
}
|
||||
|
||||
// Ignore the MORE flag for raw-sock or assert?
|
||||
if (options.raw_sock)
|
||||
if (options.raw_socket)
|
||||
msg_->reset_flags (msg_t::more);
|
||||
|
||||
// Check whether this is the last part of the message.
|
||||
@@ -235,7 +235,7 @@ int zmq::router_t::xsend (msg_t *msg_)
|
||||
// Close the remote connection if user has asked to do so
|
||||
// by sending zero length message.
|
||||
// Pending messages in the pipe will be dropped (on receiving term- ack)
|
||||
if (raw_sock && msg_->size() == 0) {
|
||||
if (raw_socket && msg_->size() == 0) {
|
||||
current_out->terminate (false);
|
||||
int rc = msg_->close ();
|
||||
errno_assert (rc == 0);
|
||||
@@ -397,14 +397,14 @@ bool zmq::router_t::identify_peer (pipe_t *pipe_)
|
||||
zmq_assert(false); // Not allowed to duplicate an existing rid
|
||||
}
|
||||
else
|
||||
if (options.raw_sock) { // Always assign identity for raw-socket
|
||||
if (options.raw_socket) { // Always assign identity for raw-socket
|
||||
unsigned char buf [5];
|
||||
buf [0] = 0;
|
||||
put_uint32 (buf + 1, next_rid++);
|
||||
identity = blob_t (buf, sizeof buf);
|
||||
}
|
||||
else
|
||||
if (!options.raw_sock) {
|
||||
if (!options.raw_socket) {
|
||||
// Pick up handshake cases and also case where next identity is set
|
||||
msg.init ();
|
||||
ok = pipe_->read (&msg);
|
||||
|
||||
Reference in New Issue
Block a user