zeromq/libzmq — pull request #1229 by lysyloren (2014-10-27 13:25:06+00:00)
Title: Unbind socket with real endpoint when binding by wild-card * address

When we bind socket with wild-card * address (e.g. tcp://127.0.0.1:* or ipc://*),
and try to unbind with real endpoint then it fails with error "No such file or directory".
Example code:
```
#include
#include
#include
#include
#include
int main (void) {
int rc;
size_t buf_size=100;
char buffer[buf_size];
void *context = zmq_ctx_new ();
void *socket = zmq_socket (context, ZMQ_SUB);
rc = zmq_bind (socket, "tcp://127.0.0.1:*");
assert (rc == 0);
rc = zmq_getsockopt (socket, ZMQ_LAST_ENDPOINT, buffer, &buf_size);
assert (rc == 0);
printf("%s\n", buffer);
rc = zmq_unbind (socket, buffer);
if (rc == -1)
printf ("ERROR: %s\n", strerror (errno));
}
```
The output of executing above is:

tcp://127.0.0.1:39969
ERROR: No such file or directory

When we try to unbind with endpoint tcp://127.0.0.1:* it unbinds clearly.
This behaviour is ok, when we have one binding per socket.
BUT when we bind socket to several endpoints with wild-card we have no
control over exact unbinding our endpoints. I think we REALLY SHOULD be able to unbind
socket by real endpoint returned via getsockopt(ZMQ_LAST_ENDPOINT).
The same behaviour with ipc transport (ipc://*).

This proposition introduces backward incompatible changes with previous versions. Unbinding with wild-card address will be no more possible.