Commit 09e7416e authored by lysyloren's avatar lysyloren

Unbind socket with real endpoint when binding by wild-card * address

parent d6c4750d
...@@ -35,7 +35,7 @@ operating system namespace used by the 'ipc' implementation, and must fulfill ...@@ -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 any restrictions placed by the operating system on the format and length of a
'pathname'. '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 pathname. The caller should retrieve this pathname using the ZMQ_LAST_ENDPOINT
socket option. See linkzmq:zmq_getsockopt[3] for details. 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. ...@@ -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 On Linux, the maximum is 113 characters including the "ipc://" prefix (107
characters for the real path name). 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 Connecting a socket
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
When connecting a 'socket' to a peer address using _zmq_connect()_ with the When connecting a 'socket' to a peer address using _zmq_connect()_ with the
......
...@@ -46,6 +46,11 @@ When using ephemeral ports, the caller should retrieve the actual assigned ...@@ -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] port using the ZMQ_LAST_ENDPOINT socket option. See linkzmq:zmq_getsockopt[3]
for details. 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 Connecting a socket
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -401,7 +401,7 @@ int zmq::socket_base_t::bind (const char *addr_) ...@@ -401,7 +401,7 @@ int zmq::socket_base_t::bind (const char *addr_)
// Save last endpoint URI // Save last endpoint URI
listener->get_address (last_endpoint); listener->get_address (last_endpoint);
add_endpoint (addr_, (own_t *) listener, NULL); add_endpoint (last_endpoint.c_str (), (own_t *) listener, NULL);
return 0; return 0;
} }
...@@ -420,7 +420,7 @@ int zmq::socket_base_t::bind (const char *addr_) ...@@ -420,7 +420,7 @@ int zmq::socket_base_t::bind (const char *addr_)
// Save last endpoint URI // Save last endpoint URI
listener->get_address (last_endpoint); listener->get_address (last_endpoint);
add_endpoint (addr_, (own_t *) listener, NULL); add_endpoint (last_endpoint.c_str (), (own_t *) listener, NULL);
return 0; return 0;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment