https://github.com/zeromq/libzmq/pull/318

2nd try wuth sock->unbind() and sock->disconnect(). now with blackjack and 
const char*'s argument

int sock->unbind(const char)
int sock->disconnect(const char)
returns
-1 - on error
0 - if at least one endpoint was terminated

P.S.
Thanks to Martin Sustrik for templates ^) I took some…

From: [email protected] 
[mailto:[email protected]] On Behalf Of Sergey Hripchenko
Sent: Thursday, April 19, 2012 12:22 AM
To: [email protected]
Subject: [zeromq-dev] [PULL] x317: implement zmq_unbind(), zmq_disconnect(), 
zmq->sock->getsockopt(ZMQ_LAST_ENDPOINT_ID)

Please review and approve.

The usage scheme:



After EACH successful call to sock->bind() or sock->connect() you can call
sock->getsockopt(ZMQ_LAST_ENDPOINT) to obtain resolved endpoint address string 
and
sock->getsockopt(ZMQ_LAST_ENDPOINT_ID) to obtain 'void *' endpoint handle.



Later on you can call sock->unbind() or sock->disconnect() with saved endpoint 
handle to terminate endpoint.
(Of course if we want to do it right we need to change sock->bind() and 
sock->connect() to return endpoint handle if succeeded, but API change is 
almost impossible...)



Current implementation cons/incompatibilities (and potential improvements):
* doesn't work with 'inproc' transport(just unset ZMQLAST_ENDPOINT and 
ZMQ_LAST_ENDPOINT_ID after every call to bind(inproc://) or connect(inproc://). 
I just don't know how it works :(
* no specific error code/confirmation that endpoint handle passed to 
unbind()/disconnect() is actually valid and terminated. Easily could be 
implemented if needed.
* ZMQ_LAST_ENDPOINT changed more often than before(after _EACH successful call 
to bind()/connect() )
* *address_t->to_string() hierarchy could be improved.


________________________________

This message is intended only for the person(s) to which it is addressed and 
may contain Intermedia.net Inc privileged, confidential and/or proprietary 
information. If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer. Any 
disclosure, copying, distribution, or the taking of any action concerning the 
contents of this message and any attachment(s) by anyone other than the named 
recipient(s) is strictly prohibited.

________________________________

This message is intended only for the person(s) to which it is addressed and 
may contain Intermedia.net Inc privileged, confidential and/or proprietary 
information. If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer. Any 
disclosure, copying, distribution, or the taking of any action concerning the 
contents of this message and any attachment(s) by anyone other than the named 
recipient(s) is strictly prohibited.
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to