[zeromq-dev] [PATCH] Add ZMQ_RCVTIMEO/SNDTIMEO sockopt [was: [PATCH] Add ZMQ_TIMEOUT sockopt]

Fabien Niñoles fabien.ninoles at gmail.com
Sun Jun 5 23:51:48 CEST 2011

Sorry for the long time before sending back a new patch, but here it
is. The basic changes are I rename ZMQ_TIMEOUT to ZMQ_RCVTIMEO and
ZMQ_SNDTIMEO and I used polling instead of a busy loop in the
mailbox_t::recv method.  Two things I'm not sure:

- I use zmq_poll since it abstracts nicely the different poll
implementation but this is an external API and it is usually bad
practices to do it so.   It's probably far worse to duplicate such
complex piece of code, so I kept it this way unless you tell me

- The windows version of mailbox_t::recv only differ in the error
handling (wsa_assert/SOCKET_ERROR instead of errno_assert/-1) and I
merged them for this reason. Shouldn't we have an abstraction for this
instead of the ugly ZMQ_HAS_WINDOWS #ifdef ?


2011/5/23 Fabien Niñoles <fabien.ninoles at gmail.com>:
> OK, I would go with a little more specs here, to be more in line with
> the normal socket behavior.
> - Value is an uint32 in ms (to be compatible with windows and kept the
> implementation simple).
> - Default to 0, which would mean block infinitely.
> - On timeout, return EAGAIN.
> Everything's ok with you ?
> Fabien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-sockopt-ZMQ_RCVTIMEO-ZMQ_SNDTIMEO.patch
Type: text/x-patch
Size: 22463 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110605/213ad3c3/attachment.bin>

More information about the zeromq-dev mailing list