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@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to