mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-26 10:32:58 +01:00
Merge pull request #1322 from hintjens/master
Problem: commit afb24b53 broke ZMQ_STREAM contract
This commit is contained in:
@@ -180,7 +180,7 @@ void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
|
||||
handle = add_fd (s);
|
||||
io_error = false;
|
||||
|
||||
if (options.raw_sock) {
|
||||
if (options.raw_socket) {
|
||||
// no handshaking for raw sock, instantiate raw encoder and decoders
|
||||
encoder = new (std::nothrow) raw_encoder_t (out_batch_size);
|
||||
alloc_assert (encoder);
|
||||
@@ -194,13 +194,15 @@ void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
|
||||
next_msg = &stream_engine_t::pull_msg_from_session;
|
||||
process_msg = &stream_engine_t::push_msg_to_session;
|
||||
|
||||
// For raw sockets, send an initial 0-length message to the
|
||||
// application so that it knows a peer has connected.
|
||||
msg_t connector;
|
||||
connector.init();
|
||||
push_msg_to_session (&connector);
|
||||
connector.close();
|
||||
session->flush ();
|
||||
if (options.raw_notify) {
|
||||
// For raw sockets, send an initial 0-length message to the
|
||||
// application so that it knows a peer has connected.
|
||||
msg_t connector;
|
||||
connector.init();
|
||||
push_msg_to_session (&connector);
|
||||
connector.close();
|
||||
session->flush ();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// start optional timer, to prevent handshake hanging on no input
|
||||
@@ -911,7 +913,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_sock) {
|
||||
if (options.raw_socket) {
|
||||
// For raw sockets, send a final 0-length message to the application
|
||||
// so that it knows the peer has been disconnected.
|
||||
msg_t terminator;
|
||||
@@ -931,7 +933,7 @@ void zmq::stream_engine_t::set_handshake_timer ()
|
||||
{
|
||||
zmq_assert (!has_handshake_timer);
|
||||
|
||||
if (!options.raw_sock && options.handshake_ivl > 0) {
|
||||
if (!options.raw_socket && options.handshake_ivl > 0) {
|
||||
add_timer (options.handshake_ivl, handshake_timer_id);
|
||||
has_handshake_timer = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user