Changeset 9306 for trunk/libtransmission/announcer.c
- Timestamp:
- Oct 12, 2009, 11:16:51 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/announcer.c
r9305 r9306 24 24 #include "publish.h" 25 25 #include "session.h" 26 #include "tr-dht.h" 26 27 #include "torrent.h" 27 28 #include "utils.h" … … 1566 1567 const tr_bool canAnnounce = announcer->announceSlotsAvailable > 0; 1567 1568 const tr_bool canScrape = announcer->scrapeSlotsAvailable > 0; 1569 tr_torrent * tor = NULL; 1570 const time_t now = time( NULL ); 1568 1571 1569 1572 if( announcer->announceSlotsAvailable > 0 ) … … 1571 1574 int i; 1572 1575 int n; 1573 const time_t now = time( NULL );1574 tr_torrent * tor = NULL;1575 1576 tr_ptrArray announceMe = TR_PTR_ARRAY_INIT; 1576 1577 tr_ptrArray scrapeMe = TR_PTR_ARRAY_INIT; … … 1615 1616 tr_ptrArrayDestruct( &scrapeMe, NULL ); 1616 1617 tr_ptrArrayDestruct( &announceMe, NULL ); 1618 } 1619 1620 tor = NULL; 1621 while(( tor = tr_torrentNext( announcer->session, tor ))) { 1622 if( tor->dhtAnnounceAt <= now ) { 1623 int rc = 1; 1624 if( tor->isRunning && tr_torrentAllowsDHT(tor) ) 1625 rc = tr_dhtAnnounce(tor, 1); 1626 if(rc == 0) 1627 /* The DHT is not ready yet. Try again soon. */ 1628 tor->dhtAnnounceAt = now + 5 + tr_cryptoWeakRandInt( 5 ); 1629 else 1630 /* We should announce at least once every 30 minutes. */ 1631 tor->dhtAnnounceAt = now + 25 * 60 + tr_cryptoWeakRandInt( 3 * 60 ); 1632 } 1617 1633 } 1618 1634 }
Note: See TracChangeset
for help on using the changeset viewer.