#1042: "Announce allowed: Never"

This commit is contained in:
Charles Kerr
2008-07-11 11:51:15 +00:00
parent 87ff06144a
commit eb254b8a54
3 changed files with 32 additions and 14 deletions

View File

@@ -1238,18 +1238,21 @@ tracker_page_new( TrTorrent * gtor )
}
static void
refresh_countdown_lb( GtkWidget * l, time_t t,
refresh_countdown_lb( GtkWidget * w, time_t t,
const char * countdown_done )
{
const time_t now = time( NULL );
GtkLabel * l = GTK_LABEL( w );
if( !t || ( t < now ) )
gtk_label_set_text( GTK_LABEL( l ), countdown_done );
if( t == 1 )
gtk_label_set_text( l, _( "In progress" ) );
else if( t < now )
gtk_label_set_text( l, countdown_done );
else {
char buf[1024];
const int seconds = t - now;
tr_strltime( buf, seconds, sizeof( buf ) );
gtk_label_set_text( GTK_LABEL( l ), buf );
gtk_label_set_text( l, buf );
}
}

View File

@@ -723,12 +723,13 @@ invokeRequest( void * vreq )
if( req->reqtype == TR_REQ_SCRAPE )
{
t->lastScrapeTime = now;
t->scrapeAt = 0;
t->scrapeAt = 1;
}
else
{
t->lastAnnounceTime = now;
t->reannounceAt = 0;
t->reannounceAt = 1;
t->manualAnnounceAllowedAt = 1;
t->scrapeAt = req->reqtype == TR_REQ_STOPPED
? now + t->scrapeIntervalSec + t->randOffset
: 0;
@@ -782,13 +783,20 @@ pulse( void * vsession )
{
tr_tracker * t = tor->tracker;
if( t->scrapeAt && trackerSupportsScrape( t, tor ) && ( now >= t->scrapeAt ) ) {
t->scrapeAt = 0;
if( ( t->scrapeAt > 1 ) &&
( t->scrapeAt <= now ) &&
( trackerSupportsScrape( t, tor ) ) )
{
t->scrapeAt = 1;
enqueueScrape( session, t );
}
if( t->reannounceAt && t->isRunning && ( now >= t->reannounceAt ) ) {
t->reannounceAt = 0;
if( ( t->reannounceAt > 1 ) &&
( t->reannounceAt <= now ) &&
( t->isRunning ) )
{
t->reannounceAt = 1;
t->manualAnnounceAllowedAt = 1;
enqueueRequest( session, t, TR_REQ_REANNOUNCE );
}
}

View File

@@ -1301,8 +1301,10 @@ typedef struct tr_stat
or zero if one hasn't been sent yet. */
time_t lastScrapeTime;
/** Time when the next scrape request will be sent.
This value is always a valid time. */
/** Time when the next scrape request will be sent,
or 0 if an error has occured that stops scraping,
or 1 if a scrape is currently in progress s.t.
we haven't set a timer for the next one yet. */
time_t nextScrapeTime;
/** Time the most recent announce request was sent,
@@ -1310,12 +1312,17 @@ typedef struct tr_stat
time_t lastAnnounceTime;
/** Time when the next reannounce request will be sent,
or zero if the torrent is stopped. */
or 0 if the torrent is stopped,
or 1 if an announce is currently in progress s.t.
we haven't set a timer for the next one yet */
time_t nextAnnounceTime;
/** If the torrent is running, this is the time at which
the client can manually ask the torrent's tracker
for more peers. otherwise, the value is zero. */
for more peers,
or 0 if the torrent is stopped or doesn't allow manual,
or 1 if an announce is currently in progress s.t.
we haven't set a timer for the next one yet */
time_t manualAnnounceTime;
/** A very rough estimate in KiB/s of how quickly data is being