Changeset 12229


Ignore:
Timestamp:
Mar 25, 2011, 5:34:26 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) API cleanup of the tr_address functions to make them more consistent.

This is loosely related to #2910, but only in the sense of laying the groundwork for #2910's fix...

Location:
trunk/libtransmission
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer-http.c

    r12204 r12229  
    139139        if( !tr_bencDictFindStr( peer, "ip", &ip ) )
    140140            continue;
    141         if( tr_pton( ip, &addr ) == NULL )
     141        if( !tr_address_from_string( &addr, ip ) )
    142142            continue;
    143143        if( !tr_bencDictFindInt( peer, "port", &port ) )
     
    145145        if( ( port < 0 ) || ( port > USHRT_MAX ) )
    146146            continue;
    147         if( !tr_isValidPeerAddress( &addr, port ) )
     147        if( !tr_address_is_valid_for_peers( &addr, port ) )
    148148            continue;
    149149
  • trunk/libtransmission/blocklist-test.c

    r12223 r12229  
    6969
    7070    /* now run some tests */
    71     check( tr_pton( "216.16.1.143", &addr ) );
     71    check( tr_address_from_string( &addr, "216.16.1.143" ) );
    7272    check( !_tr_blocklistHasAddress( b, &addr ) );
    73     check( tr_pton( "216.16.1.144", &addr ) );
     73    check( tr_address_from_string( &addr, "216.16.1.144" ) );
    7474    check( _tr_blocklistHasAddress( b, &addr ) );
    75     check( tr_pton( "216.16.1.145", &addr ) );
     75    check( tr_address_from_string( &addr, "216.16.1.145" ) );
    7676    check( _tr_blocklistHasAddress( b, &addr ) );
    77     check( tr_pton( "216.16.1.146", &addr ) );
     77    check( tr_address_from_string( &addr, "216.16.1.146" ) );
    7878    check( _tr_blocklistHasAddress( b, &addr ) );
    79     check( tr_pton( "216.16.1.147", &addr ) );
     79    check( tr_address_from_string( &addr, "216.16.1.147" ) );
    8080    check( _tr_blocklistHasAddress( b, &addr ) );
    81     check( tr_pton( "216.16.1.148", &addr ) );
     81    check( tr_address_from_string( &addr, "216.16.1.148" ) );
    8282    check( _tr_blocklistHasAddress( b, &addr ) );
    83     check( tr_pton( "216.16.1.149", &addr ) );
     83    check( tr_address_from_string( &addr, "216.16.1.149" ) );
    8484    check( _tr_blocklistHasAddress( b, &addr ) );
    85     check( tr_pton( "216.16.1.150", &addr ) );
     85    check( tr_address_from_string( &addr, "216.16.1.150" ) );
    8686    check( _tr_blocklistHasAddress( b, &addr ) );
    87     check( tr_pton( "216.16.1.151", &addr ) );
     87    check( tr_address_from_string( &addr, "216.16.1.151" ) );
    8888    check( _tr_blocklistHasAddress( b, &addr ) );
    89     check( tr_pton( "216.16.1.152", &addr ) );
     89    check( tr_address_from_string( &addr, "216.16.1.152" ) );
    9090    check( !_tr_blocklistHasAddress( b, &addr ) );
    91     check( tr_pton( "216.16.1.153", &addr ) );
     91    check( tr_address_from_string( &addr, "216.16.1.153" ) );
    9292    check( !_tr_blocklistHasAddress( b, &addr ) );
    93     check( tr_pton( "217.0.0.1", &addr ) );
     93    check( tr_address_from_string( &addr, "217.0.0.1" ) );
    9494    check( !_tr_blocklistHasAddress( b, &addr ) );
    95     check( tr_pton( "255.0.0.1", &addr ) );
     95    check( tr_address_from_string( &addr, "255.0.0.1" ) );
    9696
    9797    /* cleanup */
  • trunk/libtransmission/blocklist.c

    r12228 r12229  
    198198
    199199void
    200 _tr_blocklistSetEnabled( tr_blocklist * b,
    201                          int            isEnabled )
     200_tr_blocklistSetEnabled( tr_blocklist * b, bool isEnabled )
    202201{
    203202    b->isEnabled = isEnabled ? 1 : 0;
     
    205204
    206205int
    207 _tr_blocklistHasAddress( tr_blocklist     * b,
    208                          const tr_address * addr )
     206_tr_blocklistHasAddress( tr_blocklist * b, const tr_address * addr )
    209207{
    210208    uint32_t                     needle;
    211209    const struct tr_ipv4_range * range;
    212210
    213     assert( tr_isAddress( addr ) );
     211    assert( tr_address_is_valid( addr ) );
    214212
    215213    if( !b->isEnabled || addr->type == TR_AF_INET6 )
     
    257255
    258256    tr_snprintf( str, sizeof( str ), "%d.%d.%d.%d", b[0], b[1], b[2], b[3] );
    259     if( tr_pton( str, &addr ) == NULL )
     257    if( !tr_address_from_string( &addr, str ) )
    260258        return false;
    261259    range->begin = ntohl( addr.addr.addr4.s_addr );
    262260
    263261    tr_snprintf( str, sizeof( str ), "%d.%d.%d.%d", e[0], e[1], e[2], e[3] );
    264     if( tr_pton( str, &addr ) == NULL )
     262    if( !tr_address_from_string( &addr, str ) )
    265263        return false;
    266264    range->end = ntohl( addr.addr.addr4.s_addr );
     
    289287
    290288    tr_snprintf( str, sizeof(str), "%d.%d.%d.%d", a[0], a[1], a[2], a[3] );
    291     if( tr_pton( str, &addr ) == NULL )
     289    if( !tr_address_from_string( &addr, str ) )
    292290        return false;
    293291    range->begin = ntohl( addr.addr.addr4.s_addr );
    294292
    295293    tr_snprintf( str, sizeof(str), "%d.%d.%d.%d", b[0], b[1], b[2], b[3] );
    296     if( tr_pton( str, &addr ) == NULL )
     294    if( !tr_address_from_string( &addr, str ) )
    297295        return false;
    298296    range->end = ntohl( addr.addr.addr4.s_addr );
  • trunk/libtransmission/blocklist.h

    r12204 r12229  
    3535
    3636void          _tr_blocklistSetEnabled  ( tr_blocklist            * b,
    37                                          int                       isEnabled );
     37                                         bool                      isEnabled );
    3838
    3939int           _tr_blocklistHasAddress  ( tr_blocklist            * b,
  • trunk/libtransmission/fdlimit.c

    r12223 r12229  
    671671    if( fd >= 0 )
    672672    {
    673         if( ( gFd->socket_count < gFd->socket_limit ) && tr_ssToAddr( addr, port, &sock ) )
     673        if( ( gFd->socket_count < gFd->socket_limit )
     674            && tr_address_from_sockaddr_storage( addr, port, &sock ) )
    674675        {
    675676            ++gFd->socket_count;
  • trunk/libtransmission/net.c

    r12225 r12229  
    8282
    8383const char *
    84 tr_ntop( const tr_address * src, char * dst, int size )
    85 {
    86     assert( tr_isAddress( src ) );
    87 
    88     if( src->type == TR_AF_INET )
    89         return evutil_inet_ntop( AF_INET, &src->addr, dst, size );
     84tr_address_to_string_with_buf( const tr_address * addr, char * buf, size_t buflen )
     85{
     86    assert( tr_address_is_valid( addr ) );
     87
     88    if( addr->type == TR_AF_INET )
     89        return evutil_inet_ntop( AF_INET, &addr->addr, buf, buflen );
    9090    else
    91         return evutil_inet_ntop( AF_INET6, &src->addr, dst, size );
     91        return evutil_inet_ntop( AF_INET6, &addr->addr, buf, buflen );
    9292}
    9393
    9494/*
    95  * Non-threadsafe version of tr_ntop, which uses a static memory area for a buffer.
     95 * Non-threadsafe version of tr_address_to_string_with_buf()
     96 * and uses a static memory area for a buffer.
    9697 * This function is suitable to be called from libTransmission's networking code,
    9798 * which is single-threaded.
    9899 */
    99100const char *
    100 tr_ntop_non_ts( const tr_address * src )
     101tr_address_to_string( const tr_address * addr )
    101102{
    102103    static char buf[INET6_ADDRSTRLEN];
    103     return tr_ntop( src, buf, sizeof( buf ) );
    104 }
    105 
    106 tr_address *
    107 tr_pton( const char * src, tr_address * dst )
    108 {
    109     int retval = evutil_inet_pton( AF_INET, src, &dst->addr );
    110     assert( dst );
    111     if( retval < 0 )
    112         return NULL;
    113     else if( retval == 0 )
    114         retval = evutil_inet_pton( AF_INET6, src, &dst->addr );
    115     else
    116     {
     104    return tr_address_to_string_with_buf( addr, buf, sizeof( buf ) );
     105}
     106
     107bool
     108tr_address_from_string( tr_address * dst, const char * src )
     109{
     110    bool ok;
     111
     112    if(( ok = evutil_inet_pton( AF_INET, src, &dst->addr ) == 1 ))
    117113        dst->type = TR_AF_INET;
    118         return dst;
    119     }
    120 
    121     if( retval < 1 )
    122         return NULL;
    123     dst->type = TR_AF_INET6;
    124     return dst;
     114
     115    if( !ok ) /* try IPv6 */
     116        if(( ok = evutil_inet_pton( AF_INET6, src, &dst->addr ) == 1 ))
     117            dst->type = TR_AF_INET6;
     118
     119    return ok;
    125120}
    126121
     
    133128 */
    134129int
    135 tr_compareAddresses( const tr_address * a, const tr_address * b)
     130tr_address_compare( const tr_address * a, const tr_address * b)
    136131{
    137132    static const int sizes[2] = { sizeof(struct in_addr), sizeof(struct in6_addr) };
     
    171166
    172167bool
    173 tr_ssToAddr( tr_address * setme_addr,
    174              tr_port    * setme_port,
    175              const struct sockaddr_storage * from )
     168tr_address_from_sockaddr_storage( tr_address                    * setme_addr,
     169                                  tr_port                        * setme_port,
     170                                  const struct sockaddr_storage * from )
    176171{
    177172    if( from->ss_family == AF_INET )
     
    201196                struct sockaddr_storage * sockaddr)
    202197{
    203     assert( tr_isAddress( addr ) );
     198    assert( tr_address_is_valid( addr ) );
    204199
    205200    if( addr->type == TR_AF_INET )
     
    240235    struct sockaddr_storage source_sock;
    241236
    242     assert( tr_isAddress( addr ) );
    243 
    244     if( !tr_isValidPeerAddress( addr, port ) )
     237    assert( tr_address_is_valid( addr ) );
     238
     239    if( !tr_address_is_valid_for_peers( addr, port ) )
    245240        return -EINVAL;
    246241
     
    270265    {
    271266        tr_err( _( "Couldn't set source address %s on %d: %s" ),
    272                 tr_ntop_non_ts( source_addr ), s, tr_strerror( errno ) );
     267                tr_address_to_string( source_addr ), s, tr_strerror( errno ) );
    273268        return -errno;
    274269    }
     
    286281                || addr->type == TR_AF_INET )
    287282            tr_err( _( "Couldn't connect socket %d to %s, port %d (errno %d - %s)" ),
    288                     s, tr_ntop_non_ts( addr ), (int)ntohs( port ), tmperrno,
     283                    s, tr_address_to_string( addr ), (int)ntohs( port ), tmperrno,
    289284                    tr_strerror( tmperrno ) );
    290285        tr_netClose( session, s );
     
    321316    int optval;
    322317
    323     assert( tr_isAddress( addr ) );
     318    assert( tr_address_is_valid( addr ) );
    324319
    325320    fd = socket( domains[addr->type], SOCK_STREAM, 0 );
     
    366361                fmt = _( "Couldn't bind port %d on %s: %s (%s)" );
    367362
    368             tr_err( fmt, port, tr_ntop_non_ts( addr ), tr_strerror( err ), hint );
     363            tr_err( fmt, port, tr_address_to_string( addr ), tr_strerror( err ), hint );
    369364        }
    370365        tr_netCloseSocket( fd );
     
    374369
    375370    if( !suppressMsgs )
    376         tr_dbg( "Bound socket %d to port %d on %s", fd, port, tr_ntop_non_ts( addr ) );
     371        tr_dbg( "Bound socket %d to port %d on %s", fd, port, tr_address_to_string( addr ) );
    377372
    378373    if( listen( fd, 128 ) == -1 ) {
     
    613608        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    614609
    615     assert( tr_isAddress( a ) );
     610    assert( tr_address_is_valid( a ) );
    616611
    617612    switch( a->type )
     
    645640
    646641bool
    647 tr_isValidPeerAddress( const tr_address * addr, tr_port port )
     642tr_address_is_valid_for_peers( const tr_address * addr, tr_port port )
    648643{
    649644    return ( port != 0 )
    650         && ( tr_isAddress( addr ) )
     645        && ( tr_address_is_valid( addr ) )
    651646        && ( !isIPv6LinkLocalAddress( addr ) )
    652647        && ( !isIPv4MappedAddress( addr ) )
  • trunk/libtransmission/net.h

    r12225 r12229  
    5454#endif
    5555
    56 struct tr_session;
     56/****
     57*****
     58*****  tr_address
     59*****
     60****/
    5761
    5862typedef enum tr_address_type
     
    7882extern const tr_address tr_in6addr_any;
    7983
    80 bool tr_ssToAddr( tr_address * setme_addr,
    81                   tr_port    * setme_port,
    82                   const struct sockaddr_storage * from );
     84const char* tr_address_to_string( const tr_address * addr );
    8385
    84 const char *tr_ntop( const tr_address * src,
    85                      char * dst,
    86                      int size );
    87 const char *tr_ntop_non_ts( const tr_address * src );
    88 tr_address *tr_pton( const char * src,
    89                      tr_address * dst );
    90 int tr_compareAddresses( const tr_address * a,
    91                          const tr_address * b);
     86const char* tr_address_to_string_with_buf( const tr_address  * addr,
     87                                           char              * buf,
     88                                           size_t              buflen );
    9289
    93 bool tr_isValidPeerAddress( const tr_address * addr, tr_port port );
     90bool tr_address_from_string ( tr_address  * setme,
     91                              const char  * string );
    9492
    95 static inline bool tr_isAddress( const tr_address * a ) { return ( a != NULL ) && ( a->type==TR_AF_INET || a->type==TR_AF_INET6 ); }
     93bool tr_address_from_sockaddr_storage( tr_address                     * setme,
     94                                       tr_port                        * port,
     95                                       const struct sockaddr_storage  * src );
    9696
    97 bool tr_net_hasIPv6( tr_port );
     97int tr_address_compare( const tr_address * a,
     98                        const tr_address * b );
     99
     100bool tr_address_is_valid_for_peers( const tr_address  * addr,
     101                                    tr_port             port );
     102
     103static inline bool
     104tr_address_is_valid( const tr_address * a )
     105{
     106    return ( a != NULL ) && ( a->type==TR_AF_INET || a->type==TR_AF_INET6 );
     107}
    98108
    99109/***********************************************************************
    100110 * Sockets
    101111 **********************************************************************/
     112
     113struct tr_session;
     114
    102115int  tr_netOpenPeerSocket( tr_session       * session,
    103116                           const tr_address * addr,
     
    131144void tr_netInit( void );
    132145
     146bool tr_net_hasIPv6( tr_port );
     147
    133148
    134149/**
  • trunk/libtransmission/peer-io.c

    r12225 r12229  
    592592{
    593593    assert( session );
    594     assert( tr_isAddress( addr ) );
     594    assert( tr_address_is_valid( addr ) );
    595595
    596596    return tr_peerIoNew( session, parent, addr, port, NULL, true, false,
     
    611611
    612612    assert( session );
    613     assert( tr_isAddress( addr ) );
     613    assert( tr_address_is_valid( addr ) );
    614614    assert( torrentHash );
    615615
     
    806806{
    807807    static char buf[512];
    808 
    809     if( addr->type == TR_AF_INET )
    810         tr_snprintf( buf, sizeof( buf ), "%s:%u", tr_ntop_non_ts( addr ), ntohs( port ) );
    811     else
    812         tr_snprintf( buf, sizeof( buf ), "[%s]:%u", tr_ntop_non_ts( addr ), ntohs( port ) );
     808    tr_snprintf( buf, sizeof( buf ), "[%s]:%u", tr_address_to_string( addr ), ntohs( port ) );
    813809    return buf;
    814810}
  • trunk/libtransmission/peer-io.h

    r12224 r12229  
    151151        && ( io->refCount >= 0 )
    152152        && ( tr_isBandwidth( &io->bandwidth ) )
    153         && ( tr_isAddress( &io->addr ) );
     153        && ( tr_address_is_valid( &io->addr ) );
    154154}
    155155
  • trunk/libtransmission/peer-mgr.c

    r12228 r12229  
    148148        && ( atom->fromFirst < TR_PEER_FROM__MAX )
    149149        && ( atom->fromBest < TR_PEER_FROM__MAX )
    150         && ( tr_isAddress( &atom->addr ) );
     150        && ( tr_address_is_valid( &atom->addr ) );
    151151}
    152152#endif
     
    288288    const tr_handshake * a = va;
    289289
    290     return tr_compareAddresses( tr_handshakeGetAddr( a, NULL ), vb );
     290    return tr_address_compare( tr_handshakeGetAddr( a, NULL ), vb );
    291291}
    292292
     
    311311    const struct peer_atom * a = va;
    312312
    313     return tr_compareAddresses( &a->addr, vb );
     313    return tr_address_compare( &a->addr, vb );
    314314}
    315315
     
    346346peerCompare( const void * a, const void * b )
    347347{
    348     return tr_compareAddresses( tr_peerAddress( a ), tr_peerAddress( b ) );
     348    return tr_address_compare( tr_peerAddress( a ), tr_peerAddress( b ) );
    349349}
    350350
     
    18711871    struct peer_atom * a;
    18721872
    1873     assert( tr_isAddress( addr ) );
     1873    assert( tr_address_is_valid( addr ) );
    18741874    assert( from < TR_PEER_FROM__MAX );
    18751875
     
    20572057    if( tr_sessionIsAddressBlocked( session, addr ) )
    20582058    {
    2059         tr_dbg( "Banned IP address \"%s\" tried to connect to us", tr_ntop_non_ts( addr ) );
     2059        tr_dbg( "Banned IP address \"%s\" tried to connect to us", tr_address_to_string( addr ) );
    20602060        if(socket >= 0)
    20612061            tr_netClose( session, socket );
     
    21012101
    21022102        if( !tr_sessionIsAddressBlocked( t->manager->session, &pex->addr ) )
    2103             if( tr_isValidPeerAddress( &pex->addr, pex->port ) )
     2103            if( tr_address_is_valid_for_peers( &pex->addr, pex->port ) )
    21042104                ensureAtomExists( t, &pex->addr, pex->port, pex->flags, seedProbability, from );
    21052105
     
    22342234    assert( tr_isPex( b ) );
    22352235
    2236     if(( i = tr_compareAddresses( &a->addr, &b->addr )))
     2236    if(( i = tr_address_compare( &a->addr, &b->addr )))
    22372237        return i;
    22382238
     
    23342334        if( atom->addr.type == af )
    23352335        {
    2336             assert( tr_isAddress( &atom->addr ) );
     2336            assert( tr_address_is_valid( &atom->addr ) );
    23372337            walk->addr = atom->addr;
    23382338            walk->port = atom->port;
     
    26602660        tr_peer_stat *           stat = ret + i;
    26612661
    2662         tr_ntop( &atom->addr, stat->addr, sizeof( stat->addr ) );
     2662        tr_address_to_string_with_buf( &atom->addr, stat->addr, sizeof( stat->addr ) );
    26632663        tr_strlcpy( stat->client, ( peer->client ? peer->client : "" ),
    26642664                   sizeof( stat->client ) );
     
    35363536    assert( tr_isAtom( b ) );
    35373537
    3538     return tr_compareAddresses( &a->addr, &b->addr );
     3538    return tr_address_compare( &a->addr, &b->addr );
    35393539}
    35403540
  • trunk/libtransmission/peer-mgr.h

    r12224 r12229  
    140140tr_isPex( const tr_pex * pex )
    141141{
    142     return pex && tr_isAddress( &pex->addr );
     142    return pex && tr_address_is_valid( &pex->addr );
    143143}
    144144
  • trunk/libtransmission/peer-msgs-test.c

    r12111 r12229  
    4545    for( i = 0; i < SHA_DIGEST_LENGTH; ++i )
    4646        infohash[i] = 0xaa;
    47     tr_pton( "80.4.4.200", &addr );
     47    tr_address_from_string( &addr, "80.4.4.200" );
    4848
    4949    numwant = 7;
  • trunk/libtransmission/rpc-server.c

    r12226 r12229  
    690690        addr.addr.addr4 = server->bindAddress;
    691691        server->httpd = evhttp_new( server->session->event_base );
    692         evhttp_bind_socket( server->httpd, tr_ntop_non_ts( &addr ), server->port );
     692        evhttp_bind_socket( server->httpd, tr_address_to_string( &addr ), server->port );
    693693        evhttp_set_gencb( server->httpd, handle_request, server );
    694694
     
    887887    addr.type = TR_AF_INET;
    888888    addr.addr.addr4 = server->bindAddress;
    889     return tr_ntop_non_ts( &addr );
     889    return tr_address_to_string( &addr );
    890890}
    891891
     
    969969    found = tr_bencDictFindStr( settings, TR_PREFS_KEY_RPC_BIND_ADDRESS, &str );
    970970    assert( found );
    971     if( tr_pton( str, &address ) == NULL ) {
     971    if( !tr_address_from_string( &address, str ) ) {
    972972        tr_err( _( "%s is not a valid address" ), str );
    973973        address = tr_inaddr_any;
  • trunk/libtransmission/session.c

    r12228 r12229  
    238238
    239239    if( is_default_value && bindinfo )
    240         *is_default_value = !tr_strcmp0( default_value, tr_ntop_non_ts( &bindinfo->addr ) );
     240        *is_default_value = !tr_strcmp0( default_value, tr_address_to_string( &bindinfo->addr ) );
    241241
    242242    return bindinfo ? &bindinfo->addr : NULL;
     
    422422    tr_bencDictAddInt ( d, TR_PREFS_KEY_UMASK,                    s->umask );
    423423    tr_bencDictAddInt ( d, TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT, s->uploadSlotsPerTorrent );
    424     tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4,        tr_ntop_non_ts( &s->public_ipv4->addr ) );
    425     tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6,        tr_ntop_non_ts( &s->public_ipv6->addr ) );
     424    tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4,        tr_address_to_string( &s->public_ipv4->addr ) );
     425    tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6,        tr_address_to_string( &s->public_ipv6->addr ) );
    426426    tr_bencDictAddBool( d, TR_PREFS_KEY_START,                    !tr_sessionGetPaused( s ) );
    427427    tr_bencDictAddBool( d, TR_PREFS_KEY_TRASH_ORIGINAL,           tr_sessionGetDeleteSource( s ) );
     
    806806    str = TR_PREFS_KEY_BIND_ADDRESS_IPV4;
    807807    tr_bencDictFindStr( settings, TR_PREFS_KEY_BIND_ADDRESS_IPV4, &str );
    808     if( !tr_pton( str, &b.addr ) || ( b.addr.type != TR_AF_INET ) )
     808    if( !tr_address_from_string( &b.addr, str ) || ( b.addr.type != TR_AF_INET ) )
    809809        b.addr = tr_inaddr_any;
    810810    b.socket = -1;
     
    813813    str = TR_PREFS_KEY_BIND_ADDRESS_IPV6;
    814814    tr_bencDictFindStr( settings, TR_PREFS_KEY_BIND_ADDRESS_IPV6, &str );
    815     if( !tr_pton( str, &b.addr ) || ( b.addr.type != TR_AF_INET6 ) )
     815    if( !tr_address_from_string( &b.addr, str ) || ( b.addr.type != TR_AF_INET6 ) )
    816816        b.addr = tr_in6addr_any;
    817817    b.socket = -1;
  • trunk/libtransmission/tr-lpd.c

    r12226 r12229  
    533533            tr_peerMgrAddPex( tor, TR_PEER_FROM_LPD, peer, -1 );
    534534            tr_tordbg( tor, "Learned %d local peer from LPD (%s:%u)",
    535                 1, tr_ntop_non_ts( &peer->addr ), peerPort );
     535                1, tr_address_to_string( &peer->addr ), peerPort );
    536536
    537537            /* periodic reconnectPulse() deals with the rest... */
  • trunk/libtransmission/tr-utp.c

    r12228 r12229  
    114114
    115115    UTP_GetPeerName(s, from, &fromlen);
    116     if( !tr_ssToAddr( &addr, &port, &from_storage ) )
     116    if( !tr_address_from_sockaddr_storage( &addr, &port, &from_storage ) )
    117117    {
    118118        tr_nerr("UTP", "Unknown socket family");
  • trunk/libtransmission/utils.c

    r12228 r12229  
    999999
    10001000bool
    1001 tr_addressIsIP( const char * address )
    1002 {
    1003     tr_address tempAddr;
    1004     return tr_pton(address, &tempAddr) != NULL;
     1001tr_addressIsIP( const char * str )
     1002{
     1003    tr_address tmp;
     1004    return tr_address_from_string( &tmp, str );
    10051005}
    10061006
  • trunk/libtransmission/web.c

    r12204 r12229  
    182182
    183183    if((( addr = tr_sessionGetPublicAddress( s, TR_AF_INET, &is_default_value ))) && !is_default_value )
    184         curl_easy_setopt( e, CURLOPT_INTERFACE, tr_ntop_non_ts( addr ) );
     184        curl_easy_setopt( e, CURLOPT_INTERFACE, tr_address_to_string( addr ) );
    185185    else if ((( addr = tr_sessionGetPublicAddress( s, TR_AF_INET6, &is_default_value ))) && !is_default_value )
    186         curl_easy_setopt( e, CURLOPT_INTERFACE, tr_ntop_non_ts( addr ) );
     186        curl_easy_setopt( e, CURLOPT_INTERFACE, tr_address_to_string( addr ) );
    187187
    188188    if( task->cookies != NULL )
Note: See TracChangeset for help on using the changeset viewer.