problem: router doesn't know when peer disconnected

ZMQ_ROUTER_NOTIFY doesn't have a context and doesn't play nice with protocols. with ZMQ_DISCONNECT_MSG we can set it to a protocol message, like DISCONNECT in majordomo. Router will send it when a peer is disconnected. Another advantage of ZMQ_DISCONNECT_MSG is that it also works on inproc.

Together with ZMQ_HEARTBEAT it allows to build very reliable protocols, and much simpler as well.
This commit is contained in:
Doron Somech
2020-04-17 13:20:57 +03:00
parent 4c1d720a47
commit 81444136d5
18 changed files with 224 additions and 9 deletions

View File

@@ -685,7 +685,11 @@ void zmq::stream_engine_base_t::error (error_reason_t reason_)
_socket->event_disconnected (_endpoint_uri_pair, _s);
_session->flush ();
_session->engine_error (reason_);
_session->engine_error (
!_handshaking
&& (_mechanism == NULL
|| _mechanism->status () != mechanism_t::handshaking),
reason_);
unplug ();
delete this;
}