[zeromq-dev] Adding a timeout on stream handshaking

Pieter Hintjens ph at imatix.com
Thu May 8 17:10:19 CEST 2014


If you hit a real problem, the solution is by definition useful, and
we always welcome patches :-)

Not sure what the ideal name would be. We can improve it over time anyhow.

On Thu, May 8, 2014 at 4:59 PM, Will Strang <william.p.strang at gmail.com> wrote:
> 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
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list