mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-06 21:56:25 +01:00
Adding ZMQ_LAST_ENDPOINT for wildcard support on TCP and IPC sockets
This commit is contained in:
@@ -95,8 +95,25 @@ void zmq::ipc_listener_t::in_event ()
|
||||
send_attach (session, engine, false);
|
||||
}
|
||||
|
||||
int zmq::ipc_listener_t::get_address (unsigned char *addr, size_t *len)
|
||||
{
|
||||
if (bound_addr_len == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy (addr, bound_addr, bound_addr_len + 1);
|
||||
*len = bound_addr_len + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zmq::ipc_listener_t::set_address (const char *addr_)
|
||||
{
|
||||
|
||||
// Allow wildcard file
|
||||
if(*addr_ == '*') {
|
||||
addr_ = tempnam(NULL, NULL);
|
||||
}
|
||||
|
||||
// Get rid of the file associated with the UNIX domain socket that
|
||||
// may have been left behind by the previous run of the application.
|
||||
::unlink (addr_);
|
||||
@@ -125,6 +142,9 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
|
||||
if (rc != 0)
|
||||
return -1;
|
||||
|
||||
// Return the bound address
|
||||
bound_addr_len = sprintf(bound_addr, "ipc://%s", addr_);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user