[zeromq-dev] Disconnecting from permanently dead endpoints
john skaller
skaller at users.sourceforge.net
Thu Jan 26 09:13:16 CET 2012
On 26/01/2012, at 6:28 PM, Martin Lucina wrote:
>
> *click* Oh, I get it - saw the void * and didn't realise you wanted to
> use the char * address as a handle to the endpoint. Neat trick, but
> rather too far in terms of overloading for my taste.
Agreed, but the objective to get something that is fully upwards
compatible and easy to implement.
The only hard bit here is how to actually do the disconnection.
My thought is that 0MQ close the socket (async) a nd
throw away the associated infrastructure, i.e. just lose any
buffers etc. The reason is the existing use case: the connect
is dead anyhow.
>
> Also, it won't work terribly well for language bindings since it relies
> on a string also being a pointer, which just happens to be the case for
> C.
That should be no problem: the binding has to supply an actual
char * to call the C function, so it can wrap it up as an abstract
handle and return it.
>
> What I have in mind is more conventional: ZeroMQ takes a copy of the
> string passed to bind() or connect(), stashes it in the socket. unbind
> () or disconnect() are again passed a string, trawl thru all the
> bound/connected endpoints for the socket, and succeed if a match is
> found.
Slightly risky if addresses aren't unique, eg "tcp://...." vs "TCP://..
or whatever. Also a bit harder to implement because the strings
have to be free()d. And a bit slower if you have millions of
connections.
--
john skaller
skaller at users.sourceforge.net
More information about the zeromq-dev
mailing list