mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-23 07:12:47 +01: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_)
|
||||
{
|
||||
struct sockaddr_storage ss;
|
||||
#ifdef ZMQ_HAVE_HPUX
|
||||
int sl = sizeof (ss);
|
||||
#else
|
||||
socklen_t sl = sizeof (ss);
|
||||
#endif
|
||||
int rc = getsockname (_s, reinterpret_cast<sockaddr *> (&ss), &sl);
|
||||
if (rc != 0) {
|
||||
const zmq_socklen_t sl = get_socket_address (&ss);
|
||||
if (sl == 0) {
|
||||
addr_.clear ();
|
||||
return rc;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ipc_address_t addr (reinterpret_cast<struct sockaddr *> (&ss), sl);
|
||||
|
Loading…
x
Reference in New Issue
Block a user