mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 16:06:09 +00:00
Problem: code duplication around getsockname
Solution: also use get_socket_address from base class
This commit is contained in:
parent
2b04946f49
commit
e162c8bda3
@ -153,15 +153,10 @@ void zmq::ipc_listener_t::in_event ()
|
|||||||
int zmq::ipc_listener_t::get_address (std::string &addr_)
|
int zmq::ipc_listener_t::get_address (std::string &addr_)
|
||||||
{
|
{
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
#ifdef ZMQ_HAVE_HPUX
|
const zmq_socklen_t sl = get_socket_address (&ss);
|
||||||
int sl = sizeof (ss);
|
if (sl == 0) {
|
||||||
#else
|
|
||||||
socklen_t sl = sizeof (ss);
|
|
||||||
#endif
|
|
||||||
int rc = getsockname (_s, reinterpret_cast<sockaddr *> (&ss), &sl);
|
|
||||||
if (rc != 0) {
|
|
||||||
addr_.clear ();
|
addr_.clear ();
|
||||||
return rc;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc_address_t addr (reinterpret_cast<struct sockaddr *> (&ss), sl);
|
ipc_address_t addr (reinterpret_cast<struct sockaddr *> (&ss), sl);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user