From 617e80d767a2760c07da8ccffa2491bcac0362de Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 14 Feb 2010 03:40:39 +0000 Subject: [PATCH] (trunk libT) #2850 "tr_torrentSetAnnounceList() should not trigger reannounces to trackers" -- further revision to get newly-added tiers to announce --- libtransmission/announcer.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index 2a595d683..489842646 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -28,6 +28,8 @@ #include "utils.h" #include "web.h" +#define STARTED "started" + #define dbgmsg( tier, ... ) \ if( tr_deepLoggingIsActive( ) ) do { \ char name[128]; \ @@ -822,6 +824,9 @@ tr_announcerAddTorrent( tr_announcer * announcer, tr_torrent * tor ) return tiers; } +static void +tierAddAnnounce( tr_tier * tier, const char * announceEvent, time_t announceAt ); + void 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 */ + if( tor->isRunning ) { - /* start the torrent, if applicable */ - 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; iisRunning ) + tierAddAnnounce( tier, STARTED, now ); + } } /* cleanup */ @@ -975,7 +987,7 @@ torrentAddAnnounce( tr_torrent * tor, const char * announceEvent, time_t announc void tr_announcerTorrentStarted( tr_torrent * tor ) { - torrentAddAnnounce( tor, "started", tr_time( ) ); + torrentAddAnnounce( tor, STARTED, tr_time( ) ); } void tr_announcerManualAnnounce( tr_torrent * tor )