mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-08 14:56:14 +01:00
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:
@@ -828,6 +828,13 @@ void zmq::ctx_t::connect_inproc_sockets (
|
||||
pending_connection_.bind_pipe->set_hwms (-1, -1);
|
||||
}
|
||||
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
if (bind_options_.can_recv_disconnect_msg
|
||||
&& !bind_options_.disconnect_msg.empty ())
|
||||
pending_connection_.connect_pipe->set_disconnect_msg (
|
||||
bind_options_.disconnect_msg);
|
||||
#endif
|
||||
|
||||
if (side_ == bind_side) {
|
||||
command_t cmd;
|
||||
cmd.type = command_t::bind;
|
||||
|
||||
Reference in New Issue
Block a user