Changeset 8251


Ignore:
Timestamp:
Apr 17, 2009, 4:49:56 PM (13 years ago)
Author:
charles
Message:

(trunk libT) #1996: Regression: Crash on shutdown when IPv6 is unavailable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/session.c

    r8246 r8251  
    309309tr_sessionGetSettings( tr_session * s, struct tr_benc * d )
    310310{
     311    const char * val;
     312    const tr_address * addr;
     313
    311314    assert( tr_bencIsDict( d ) );
    312315
     
    357360    tr_bencDictAddBool( d, TR_PREFS_KEY_USPEED_ENABLED,           tr_sessionIsSpeedLimited( s, TR_UP ) );
    358361    tr_bencDictAddInt ( d, TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT, s->uploadSlotsPerTorrent );
    359     tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4,
    360                         tr_ntop_non_ts( tr_socketListGetType( tr_getSessionBindSockets( s ), TR_AF_INET ) ) );
    361     tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6,
    362                         tr_ntop_non_ts( tr_socketListGetType( tr_getSessionBindSockets( s ), TR_AF_INET6 ) ) );
     362
     363    addr = tr_socketListGetType( tr_getSessionBindSockets( s ), TR_AF_INET );
     364    val = addr ? tr_ntop_non_ts( addr ) : TR_DEFAULT_BIND_ADDRESS_IPV4;
     365    tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4, val );
     366
     367    addr = tr_socketListGetType( tr_getSessionBindSockets( s ), TR_AF_INET6 );
     368    val = addr ? tr_ntop_non_ts( addr ) : TR_DEFAULT_BIND_ADDRESS_IPV6;
     369    tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6, val );
    363370}
    364371
Note: See TracChangeset for help on using the changeset viewer.