Ignore:
Timestamp:
Mar 4, 2011, 9:00:52 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) new function: tr_ssToAddr()

This handles converting the data in a sockaddr_storage to a tr_address + port, and removes redundant code from fdlimit.c and tr-udp.c that previously did this work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tr-utp.c

    r12077 r12094  
    115115   
    116116    UTP_GetPeerName(s, from, &fromlen);
    117     if(from->sa_family == AF_INET) {
    118         struct sockaddr_in *sin = (struct sockaddr_in*)from;
    119         addr.type = TR_AF_INET;
    120         addr.addr.addr4.s_addr = sin->sin_addr.s_addr;
    121         port = sin->sin_port;
    122     } else if(from->sa_family == AF_INET6) {
    123         struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)from;
    124         addr.type = TR_AF_INET6;
    125         addr.addr.addr6 = sin6->sin6_addr;
    126         port = sin6->sin6_port;
    127     } else {
     117    if( !tr_ssToAddr( &addr, &port, &from_storage ) )
     118    {
    128119        tr_nerr("UTP", "Unknown socket family");
    129120        UTP_Close(s);
Note: See TracChangeset for help on using the changeset viewer.