[zeromq-dev] Adding a timeout on stream handshaking

Will Strang william.p.strang at gmail.com
Thu May 8 16:59:40 CEST 2014


In our use of zeromq, we have had other software connect to a listening TCP
stream socket, and then just sit there with the socket open.  If the
connecting end sends enough bytes, that will initiate handshaking, which
will either succeed, or fail and disconnect.  But if it sends nothing, or
too few bytes for handshaking to reach a conclusion, the socket just sits
there open. So I added a timer in stream_engine to limit the time from
connect to the end of handshaking, and disconnect on timeout.  This also
works with zeromq sockets that are connecting, if the accepting end does
not start handshaking.

If this seems useful to add to zeromq, I can make a pull request.  I can
provide a unit test and documentation update.

I made this time limit configurable by zmq_setsockopt as ZMQ_HANDSHAKE_IVL,
defaulted to 30 seconds.  Or it could be defaulted to 0 (no limit), for
backward compatibility.  Any suggestions on this?

It seems to me that such "hanging" connects could be used as an attack.

Will Strang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140508/804826da/attachment.htm>


More information about the zeromq-dev mailing list