Changeset 7836


Ignore:
Timestamp:
Feb 6, 2009, 11:35:47 PM (12 years ago)
Author:
charles
Message:

(trunk libT) add in a crasher bug for Rolcol to find

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/session.c

    r7826 r7836  
    431431#endif
    432432
    433     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_LIMIT_TORRENT, &i ); 
    434     assert( found ); 
    435     session->peerLimitPerTorrent = i; 
    436  
    437     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_MSGLEVEL, &i ); 
    438     assert( found ); 
    439     tr_setMessageLevel( i ); 
    440     tr_setMessageQueuing( data->messageQueuingEnabled ); 
    441  
    442  
    443     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEX_ENABLED, &i ); 
    444     assert( found ); 
    445     session->isPexEnabled = i != 0; 
    446  
    447     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_ENCRYPTION, &i ); 
    448     assert( found ); 
     433    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_LIMIT_TORRENT, &i );
     434    assert( found );
     435    session->peerLimitPerTorrent = i;
     436
     437    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_MSGLEVEL, &i );
     438    assert( found );
     439    tr_setMessageLevel( i );
     440    tr_setMessageQueuing( data->messageQueuingEnabled );
     441
     442
     443    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEX_ENABLED, &i );
     444    assert( found );
     445    session->isPexEnabled = i != 0;
     446
     447    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_ENCRYPTION, &i );
     448    assert( found );
    449449    assert( tr_isEncryptionMode( i ) );
    450     session->encryptionMode = i; 
     450    session->encryptionMode = i;
    451451
    452452    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PREALLOCATION, &i );
     
    454454    assert( tr_isPreallocationMode( i ) );
    455455    session->preallocationMode = i;
    456  
    457     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_SOCKET_TOS, &i ); 
    458     assert( found ); 
    459     session->peerSocketTOS = i; 
    460  
    461     found = tr_bencDictFindStr( &settings, TR_PREFS_KEY_DOWNLOAD_DIR, &str ); 
    462     assert( found ); 
    463     session->downloadDir = tr_strdup( str ); 
    464  
    465     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PROXY_ENABLED, &i ); 
    466     assert( found ); 
    467     session->isProxyEnabled = i != 0; 
    468  
    469     found = tr_bencDictFindStr( &settings, TR_PREFS_KEY_PROXY, &str ); 
    470     assert( found ); 
    471     session->proxy = tr_strdup( str ); 
    472  
    473     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PROXY_PORT, &i ); 
    474     assert( found ); 
    475     session->proxyPort = i; 
    476  
    477     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PROXY_TYPE, &i ); 
    478     assert( found ); 
    479     session->proxyType = i; 
    480  
    481     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PROXY_AUTH_ENABLED, &i ); 
    482     assert( found ); 
    483     session->isProxyAuthEnabled = i != 0; 
    484  
    485     found = tr_bencDictFindStr( &settings, TR_PREFS_KEY_PROXY_USERNAME, &str ); 
    486     assert( found ); 
    487     session->proxyUsername = tr_strdup( str ); 
    488  
    489     found = tr_bencDictFindStr( &settings, TR_PREFS_KEY_PROXY_PASSWORD, &str ); 
    490     assert( found ); 
    491     session->proxyPassword = tr_strdup( str ); 
    492  
    493     session->so_sndbuf = 1500 * 3; /* 3x MTU for most ethernet/wireless */ 
    494     session->so_rcvbuf = 8192; 
    495  
    496     tr_setConfigDir( session, data->configDir ); 
     456
     457    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_SOCKET_TOS, &i );
     458    assert( found );
     459    session->peerSocketTOS = i;
     460
     461    found = tr_bencDictFindStr( &settings, TR_PREFS_KEY_DOWNLOAD_DIR, &str );
     462    assert( found );
     463    session->downloadDir = tr_strdup( str );
     464
     465    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PROXY_ENABLED, &i );
     466    assert( found );
     467    session->isProxyEnabled = i != 0;
     468
     469    found = tr_bencDictFindStr( &settings, TR_PREFS_KEY_PROXY, &str );
     470    assert( found );
     471    session->proxy = tr_strdup( str );
     472
     473    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PROXY_PORT, &i );
     474    assert( found );
     475    session->proxyPort = i;
     476
     477    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PROXY_TYPE, &i );
     478    assert( found );
     479    session->proxyType = i;
     480
     481    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PROXY_AUTH_ENABLED, &i );
     482    assert( found );
     483    session->isProxyAuthEnabled = i != 0;
     484
     485    found = tr_bencDictFindStr( &settings, TR_PREFS_KEY_PROXY_USERNAME, &str );
     486    assert( found );
     487    session->proxyUsername = tr_strdup( str );
     488
     489    found = tr_bencDictFindStr( &settings, TR_PREFS_KEY_PROXY_PASSWORD, &str );
     490    assert( found );
     491    session->proxyPassword = tr_strdup( str );
     492
     493    session->so_sndbuf = 1500 * 3; /* 3x MTU for most ethernet/wireless */
     494    session->so_rcvbuf = 8192;
     495
     496    tr_setConfigDir( session, data->configDir );
    497497
    498498    tr_trackerSessionInit( session );
     
    501501    session->peerMgr = tr_peerMgrNew( session );
    502502
    503     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_LAZY_BITFIELD, &i ); 
    504     assert( found ); 
    505     session->useLazyBitfield = i != 0; 
     503    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_LAZY_BITFIELD, &i );
     504    assert( found );
     505    session->useLazyBitfield = i != 0;
    506506
    507507    /* Initialize rate and file descripts controls */
    508508
    509     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_OPEN_FILE_LIMIT, &i ); 
    510     assert( found ); 
     509    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_OPEN_FILE_LIMIT, &i );
     510    assert( found );
    511511    session->openFileLimit = i;
    512     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, &j ); 
    513     assert( found ); 
     512    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, &j );
     513    assert( found );
    514514    tr_fdInit( session->openFileLimit, j );
    515515
    516     /** 
    517     *** random port 
    518     **/ 
    519  
    520     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_PORT_RANDOM_ENABLED, &i ); 
    521     assert( found ); 
    522     session->isPortRandom = i != 0; 
    523  
    524     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_PORT_RANDOM_LOW, &i ); 
    525     assert( found ); 
    526     session->randomPortLow = i; 
    527  
    528     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_PORT_RANDOM_HIGH, &i ); 
    529     assert( found ); 
    530     session->randomPortHigh = i; 
    531  
    532     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PORT_FORWARDING, &i ) 
    533          && tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_PORT, &j ); 
    534     assert( found ); 
    535     session->peerPort = session->isPortRandom ? getRandomPort( session ) : j; 
    536     session->shared = tr_sharedInit( session, i, session->peerPort ); 
    537     session->isPortSet = session->isPortRandom || j>0; 
    538 
    539     /** 
    540     **/ 
     516    /**
     517    *** random port
     518    **/
     519
     520    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_PORT_RANDOM_ENABLED, &i );
     521    assert( found );
     522    session->isPortRandom = i != 0;
     523
     524    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_PORT_RANDOM_LOW, &i );
     525    assert( found );
     526    session->randomPortLow = i;
     527
     528    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_PORT_RANDOM_HIGH, &i );
     529    assert( found );
     530    session->randomPortHigh = i;
     531
     532    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_PORT_FORWARDING, &i )
     533         && tr_bencDictFindInt( &settings, TR_PREFS_KEY_PEER_PORT, &j );
     534    assert( found );
     535    session->peerPort = session->isPortRandom ? getRandomPort( session ) : j;
     536    session->shared = tr_sharedInit( session, i, session->peerPort );
     537    session->isPortSet = session->isPortRandom || j>0;
     538
     539    /**
     540    **/
    541541
    542542    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT, &i );
    543543    assert( found );
    544544    session->uploadSlotsPerTorrent = i;
    545  
     545
    546546    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_USPEED, &i )
    547547         && tr_bencDictFindInt( &settings, TR_PREFS_KEY_USPEED_ENABLED, &j );
    548     assert( found ); 
     548    assert( found );
    549549    tr_sessionSetSpeedLimit( session, TR_UP, i );
    550550    tr_sessionSetSpeedLimitEnabled( session, TR_UP, j );
    551  
     551
    552552    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_DSPEED, &i )
    553553         && tr_bencDictFindInt( &settings, TR_PREFS_KEY_DSPEED_ENABLED, &j );
    554     assert( found ); 
     554    assert( found );
    555555    tr_sessionSetSpeedLimit( session, TR_DOWN, i );
    556556    tr_sessionSetSpeedLimitEnabled( session, TR_DOWN, j );
     
    560560    tr_mkdirp( filename, 0777 );
    561561    tr_free( filename );
    562     found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_BLOCKLIST_ENABLED, &i ); 
    563     assert( found ); 
    564     session->isBlocklistEnabled = i; 
    565     loadBlocklists( session ); 
    566 
    567     session->rpcServer = tr_rpcInit( session, &settings ); 
     562    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_BLOCKLIST_ENABLED, &i );
     563    assert( found );
     564    session->isBlocklistEnabled = i;
     565    loadBlocklists( session );
     566
     567    session->rpcServer = tr_rpcInit( session, &settings );
    568568
    569569    tr_bencFree( &settings );
    570570
    571571    assert( tr_isSession( session ) );
    572  
     572
    573573    /* first %s is the application name
    574574       second %s is the version number */
     
    576576
    577577    tr_statsInit( session );
    578     session->web = tr_webInit( session ); 
     578    session->web = tr_webInit( session );
    579579    metainfoLookupRescan( session );
    580580    session->isWaiting = FALSE;
     
    13301330}
    13311331
    1332 tr_port 
     1332tr_port
    13331333tr_sessionGetRPCPort( const tr_session * session )
    13341334{
     
    15811581        if( tr_torrentGetActivity( tor ) != TR_STATUS_STOPPED )
    15821582            ++ret;
    1583    
     1583
    15841584    return ret;
    15851585}
Note: See TracChangeset for help on using the changeset viewer.