[zeromq-dev] Issue 85 & 92
Martin Sustrik
sustrik at 250bpm.com
Sat Oct 2 08:56:04 CEST 2010
Hi Pieter,
>> That's OK, the question is what to do with the socket that is still open.
>
> Why are you asking this? Surely if the context is terminated, any
> further operation on any socket will fail, just as any blocking call
> on a socket fails if you terminate the context.
>
> If there are some consequences of doing the obvious thing, which I'm
> unaware of, maybe you could explain those.
The question is whether socket should be deallocated or left alone. In
former case any call currently in the socket or about to enter the
socket will SEGFAULT. In latter case the main thread terminates dropping
the unsent messages in the socket.
> zmq_term should not block forever when there is no work to do, whether
> or not I closed any sockets beforehand. If the API detects an error
> it should report it. It should not cause my application to hang.
SO_LINGER should be implemented to limit the amount of time to spend
trying to send messages. To be done later. However, it's orthogonal to
the problem above.
> The question is, what BSD socket semantics are you emulating here?
> There is no requirement in POSIX that sockets be closed before exiting
> an application, it happens automatically at exit.
I am emulating behaviour of OS kernel as such. Kernel stays in place
even if you close the socket. That gives it a chance to send unsent
messages.
Martin
More information about the zeromq-dev
mailing list