Changeset 12181 for trunk/libtransmission/announcer.c
- Timestamp:
- Mar 17, 2011, 12:34:43 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/announcer.c
r12177 r12181 29 29 #include "ptrarray.h" 30 30 #include "session.h" 31 #include "tr-dht.h"32 31 #include "tr-lpd.h" 33 32 #include "torrent.h" … … 1495 1494 1496 1495 static void 1497 dht_upkeep( tr_session * session )1498 {1499 tr_torrent * tor = NULL;1500 const time_t now = tr_time( );1501 1502 while(( tor = tr_torrentNext( session, tor )))1503 {1504 if( tor->dhtAnnounceAt <= now )1505 {1506 if( tor->isRunning && tr_torrentAllowsDHT(tor) ) {1507 const int rc = tr_dhtAnnounce(tor, AF_INET, 1);1508 if(rc == 0)1509 /* The DHT is not ready yet. Try again soon. */1510 tor->dhtAnnounceAt = now + 5 + tr_cryptoWeakRandInt( 5 );1511 else1512 /* We should announce at least once every 30 minutes. */1513 tor->dhtAnnounceAt =1514 now + 25 * 60 + tr_cryptoWeakRandInt( 3 * 60 );1515 }1516 }1517 1518 if( tor->dhtAnnounce6At <= now )1519 {1520 if( tor->isRunning && tr_torrentAllowsDHT(tor) ) {1521 const int rc = tr_dhtAnnounce(tor, AF_INET6, 1);1522 if(rc == 0)1523 tor->dhtAnnounce6At = now + 5 + tr_cryptoWeakRandInt( 5 );1524 else1525 tor->dhtAnnounce6At =1526 now + 25 * 60 + tr_cryptoWeakRandInt( 3 * 60 );1527 }1528 }1529 }1530 }1531 1532 static void1533 1496 onUpkeepTimer( int foo UNUSED, short bar UNUSED, void * vannouncer ) 1534 1497 { … … 1542 1505 /* maybe send out some announcements to trackers */ 1543 1506 announceMore( announcer ); 1544 1545 dht_upkeep( announcer->session );1546 1507 1547 1508 /* LPD upkeep */
Note: See TracChangeset
for help on using the changeset viewer.