1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

(trunk libT) #2850 "tr_torrentSetAnnounceList() should not trigger reannounces to trackers" -- further revision to get newly-added tiers to announce

This commit is contained in:
Charles Kerr 2010-02-14 03:40:39 +00:00
parent 2ad6e06ea6
commit 617e80d767

View file

@ -28,6 +28,8 @@
#include "utils.h" #include "utils.h"
#include "web.h" #include "web.h"
#define STARTED "started"
#define dbgmsg( tier, ... ) \ #define dbgmsg( tier, ... ) \
if( tr_deepLoggingIsActive( ) ) do { \ if( tr_deepLoggingIsActive( ) ) do { \
char name[128]; \ char name[128]; \
@ -822,6 +824,9 @@ tr_announcerAddTorrent( tr_announcer * announcer, tr_torrent * tor )
return tiers; return tiers;
} }
static void
tierAddAnnounce( tr_tier * tier, const char * announceEvent, time_t announceAt );
void void
tr_announcerResetTorrent( tr_announcer * announcer, tr_torrent * tor ) tr_announcerResetTorrent( tr_announcer * announcer, tr_torrent * tor )
{ {
@ -871,11 +876,18 @@ tr_announcerResetTorrent( tr_announcer * announcer, tr_torrent * tor )
} }
} }
} }
else
{ /* kickstart any tiers that didn't get started */
/* start the torrent, if applicable */
if( tor->isRunning ) if( tor->isRunning )
tr_announcerTorrentStarted( tor ); {
int i, n;
const time_t now = tr_time( );
tr_tier ** tiers = (tr_tier**) tr_ptrArrayPeek( &tor->tiers->tiers, &n );
for( i=0; i<n; ++i ) {
tr_tier * tier = tiers[i];
if( !tier->isRunning )
tierAddAnnounce( tier, STARTED, now );
}
} }
/* cleanup */ /* cleanup */
@ -975,7 +987,7 @@ torrentAddAnnounce( tr_torrent * tor, const char * announceEvent, time_t announc
void void
tr_announcerTorrentStarted( tr_torrent * tor ) tr_announcerTorrentStarted( tr_torrent * tor )
{ {
torrentAddAnnounce( tor, "started", tr_time( ) ); torrentAddAnnounce( tor, STARTED, tr_time( ) );
} }
void void
tr_announcerManualAnnounce( tr_torrent * tor ) tr_announcerManualAnnounce( tr_torrent * tor )