Problem: wildcard port binding does not work with WS sockets

Solution: remove the path from the address when resolving
This commit is contained in:
Luca Boccassi
2019-11-23 18:07:35 +00:00
parent 79d75f017c
commit c711941e9a
2 changed files with 7 additions and 2 deletions

View File

@@ -206,7 +206,10 @@ int zmq::ws_listener_t::set_local_address (const char *addr_)
if (rc != 0)
return -1;
if (create_socket (addr_) == -1)
// remove the path, otherwise resolving the port will fail with wildcard
const char *delim = strrchr (addr_, '/');
std::string host_port = std::string (addr_, delim - addr_);
if (create_socket (host_port.c_str ()) == -1)
return -1;
}