[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #18105 [Core Tor/Tor]: Replace getsockname with tor_getsockname



#18105: Replace getsockname with tor_getsockname
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:
                                                 |  eewayhsu
     Type:  enhancement                          |         Status:
                                                 |  needs_revision
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.3.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  easy, intro, api, code-              |  Actual Points:
  simplification                                 |
Parent ID:                                       |         Points:  small
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by callumw):

 Would this suffice for a new tor_getsockname function?

 MOCK_IMPL(int,
 tor_getsockname,(tor_socket_t sock, struct sockaddr *sock_address,
                  tor_addr_t *tor_address, socklen_t *address_len))
 {
    if (getsockname(sock, address, address_len) < 0) { return -1 }

    return tor_addr_from_sockaddr(&tor_address, (struct
 sockaddr*)&sock_address, NULL);
 }

 I have done it this way so that each call to tor_getsockname can be dealt
 with individually as they are now with getsockname.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18105#comment:13>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs