[zeromq-dev] [PATCH] Add ZMQ_RCVTIMEO/SNDTIMEO sockopt (fix)

Fabien Niñoles fabien.ninoles at gmail.com
Sun Jun 12 19:32:24 CEST 2011


Hi Martin,

> One more idea: Even ioctl() implementation can be optimised if mailbox_t
> remembered the actual state of socket (blocking vs. non-blocking) and issued
> ioctl() only if there was a need to change the state.

Probably not that hard and certainly a good thing:  variable lookup is
certainly faster
than any syscalls and since we are dealing with a very obvious case (a
single entry point,
a single socket and only two set of flags), not really hard to
implement.  I would still try to
kept it clear.  At worse, we will just push back the resetting to a later time.

>> So here the patch for the old blocking case behavior.  I would see if
>> I can implement the RCV_TIMEO options now.  Someone else would have to
>> check it on Windows however.
>
> Yes. Not even speaking of platforms such as AIX or HP-UX etc. The code is a
> bit fragile here. You should take care to keep the code as is for platforms
> you cannot test on.

I set a defined ZMQ_HAVE_SO_RCVTIMEO arount the changes.  HPUX is
already excluded
since the operation seems to be a noop on it, as well as Windows
(until the doc proved to be wrong).
AIX seems to support it however.

So, here the patch (again).  Feel free to check it or wait for my
memento patch (should come soon).

Fabien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-sockopt-ZMQ_RCVTIMEO-ZMQ_SNDTIMEO.patch
Type: text/x-patch
Size: 31629 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110612/27078fc3/attachment.bin>


More information about the zeromq-dev mailing list