Merge pull request #1229 from lysyloren/master

Unbind socket with real endpoint when binding by wild-card * address
This commit is contained in:
Pieter Hintjens 2014-10-28 19:08:58 +01:00
commit c9eb7b8a7b
3 changed files with 14 additions and 3 deletions

View File

@ -35,7 +35,7 @@ operating system namespace used by the 'ipc' implementation, and must fulfill
any restrictions placed by the operating system on the format and length of a
'pathname'.
When the address is `*`, _zmq_bind()_ shall generate a unique temporary
When the address is wild-card `*`, _zmq_bind()_ shall generate a unique temporary
pathname. The caller should retrieve this pathname using the ZMQ_LAST_ENDPOINT
socket option. See linkzmq:zmq_getsockopt[3] for details.
@ -57,6 +57,12 @@ NOTE: IPC pathnames have a maximum size that depends on the operating system.
On Linux, the maximum is 113 characters including the "ipc://" prefix (107
characters for the real path name).
Unbinding wild-card address from a socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When wild-card `*` 'endpoint' was used in _zmq_bind()_, the caller should use
real 'endpoind' obtained from the ZMQ_LAST_ENDPOINT socket option to unbind
this 'endpoint' from a socket using _zmq_unbind()_.
Connecting a socket
~~~~~~~~~~~~~~~~~~~
When connecting a 'socket' to a peer address using _zmq_connect()_ with the

View File

@ -46,6 +46,11 @@ When using ephemeral ports, the caller should retrieve the actual assigned
port using the ZMQ_LAST_ENDPOINT socket option. See linkzmq:zmq_getsockopt[3]
for details.
Unbinding wild-card addres from a socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When wild-card `*` 'endpoint' was used in _zmq_bind()_, the caller should use
real 'endpoind' obtained from the ZMQ_LAST_ENDPOINT socket option to unbind
this 'endpoint' from a socket using _zmq_unbind()_.
Connecting a socket
~~~~~~~~~~~~~~~~~~~

View File

@ -401,7 +401,7 @@ int zmq::socket_base_t::bind (const char *addr_)
// Save last endpoint URI
listener->get_address (last_endpoint);
add_endpoint (addr_, (own_t *) listener, NULL);
add_endpoint (last_endpoint.c_str (), (own_t *) listener, NULL);
return 0;
}
@ -420,7 +420,7 @@ int zmq::socket_base_t::bind (const char *addr_)
// Save last endpoint URI
listener->get_address (last_endpoint);
add_endpoint (addr_, (own_t *) listener, NULL);
add_endpoint (last_endpoint.c_str (), (own_t *) listener, NULL);
return 0;
}
#endif