Changeset 11612


Ignore:
Timestamp:
Dec 30, 2010, 7:26:16 PM (10 years ago)
Author:
charles
Message:

(trunk 2.0x) #3528 "TR_PREFS_KEY_BIND_ADDRESS_IPV4 breaks IPv6-only trackers" -- go with option (2) suggested by Harry in the ticket. Confirmed to solve the problem described in the ticket.

Location:
branches/2.0x/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0x/libtransmission/net.c

    r10753 r11612  
    291291
    292292    /* set source address */
    293     source_addr = tr_sessionGetPublicAddress( session, addr->type );
     293    source_addr = tr_sessionGetPublicAddress( session, addr->type, NULL );
    294294    assert( source_addr );
    295295    sourcelen = setup_sockaddr( source_addr, 0, &source_sock );
  • branches/2.0x/libtransmission/session.c

    r11467 r11612  
    214214
    215215const tr_address*
    216 tr_sessionGetPublicAddress( const tr_session * session, int tr_af_type )
    217 {
     216tr_sessionGetPublicAddress( const tr_session * session, int tr_af_type, tr_bool * is_default_value )
     217{
     218    const char * default_value;
    218219    const struct tr_bindinfo * bindinfo;
    219220
    220221    switch( tr_af_type )
    221222    {
    222         case TR_AF_INET:  bindinfo = session->public_ipv4; break;
    223         case TR_AF_INET6: bindinfo = session->public_ipv6; break;
    224         default:          bindinfo = NULL;                 break;
    225     }
     223        case TR_AF_INET:
     224            bindinfo = session->public_ipv4;
     225            default_value = TR_DEFAULT_BIND_ADDRESS_IPV4;
     226            break;
     227
     228        case TR_AF_INET6:
     229            bindinfo = session->public_ipv6;
     230            default_value = TR_DEFAULT_BIND_ADDRESS_IPV6;
     231            break;
     232
     233        default:
     234            bindinfo = NULL;
     235            default_value = NULL;
     236            break;
     237    }
     238
     239    if( is_default_value && bindinfo )
     240        *is_default_value = !strcmp( default_value, tr_ntop_non_ts( &bindinfo->addr ) );
    226241
    227242    return bindinfo ? &bindinfo->addr : NULL;
  • branches/2.0x/libtransmission/session.h

    r10638 r11612  
    202202tr_bool      tr_sessionIsLocked( const tr_session * );
    203203
    204 const struct tr_address*  tr_sessionGetPublicAddress( const tr_session *, int tr_af_type );
     204const struct tr_address*  tr_sessionGetPublicAddress( const tr_session  * session,
     205                                                      int                 tr_af_type,
     206                                                      tr_bool           * is_default_value );
     207
    205208
    206209struct tr_bindsockets * tr_sessionGetBindSockets( tr_session * );
  • branches/2.0x/libtransmission/web.c

    r10535 r11612  
    141141{
    142142    const tr_address * addr;
     143    tr_bool is_default_value;
    143144    CURL * e = curl_easy_init( );
    144145    const long verbose = getenv( "TR_CURL_VERBOSE" ) != NULL;
     
    178179    curl_easy_setopt( e, CURLOPT_WRITEFUNCTION, writeFunc );
    179180
    180     if(( addr = tr_sessionGetPublicAddress( s, TR_AF_INET )))
     181    if((( addr = tr_sessionGetPublicAddress( s, TR_AF_INET, &is_default_value ))) && !is_default_value )
     182        curl_easy_setopt( e, CURLOPT_INTERFACE, tr_ntop_non_ts( addr ) );
     183    else if ((( addr = tr_sessionGetPublicAddress( s, TR_AF_INET6, &is_default_value ))) && !is_default_value )
    181184        curl_easy_setopt( e, CURLOPT_INTERFACE, tr_ntop_non_ts( addr ) );
    182185
Note: See TracChangeset for help on using the changeset viewer.