Changeset 10099


Ignore:
Timestamp:
Feb 5, 2010, 5:16:18 AM (12 years ago)
Author:
charles
Message:

(trunk) add a new field to distinguish from error messages returned from the tracker, and announce timeouts, so that they can be displayed differently

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/remote.c

    r10083 r10099  
    13251325                    tr_bool lastAnnounceSucceeded;
    13261326                    int64_t lastAnnounceTime;
     1327                    tr_bool lastAnnounceTimedOut;
    13271328                    const char * lastScrapeResult;
    13281329                    tr_bool lastScrapeSucceeded;
     
    13491350                        tr_bencDictFindBool( t, "lastAnnounceSucceeded", &lastAnnounceSucceeded ) &&
    13501351                        tr_bencDictFindInt ( t, "lastAnnounceTime", &lastAnnounceTime ) &&
     1352                        tr_bencDictFindBool( t, "lastAnnounceTimedOut", &lastAnnounceTimedOut ) &&
    13511353                        tr_bencDictFindStr ( t, "lastScrapeResult", &lastScrapeResult ) &&
    13521354                        tr_bencDictFindInt ( t, "lastScrapeStartTime", &lastScrapeStartTime ) &&
     
    13761378                                    printf( "  Got a list of %'d peers %s ago\n",
    13771379                                            (int)lastAnnouncePeerCount, buf );
     1380                                else if( lastAnnounceTimedOut )
     1381                                    printf( "  Peer list request timed out; will retry\n" );
    13781382                                else
    13791383                                    printf( "  Got an error \"%s\" %s ago\n",
  • trunk/doc/rpc-spec.txt

    r10083 r10099  
    268268                      | lastAnnounceSucceeded   | boolean    | tr_tracker_stat
    269269                      | lastAnnounceTime        | number     | tr_tracker_stat
     270                      | lastAnnounceTimedOut    | boolean    | tr_tracker_stat
    270271                      | lastScrapeResult        | string     | tr_tracker_stat
    271272                      | lastScrapeStartTime     | number     | tr_tracker_stat
     
    581582         |         | yes       | session-get    | new arg "config-dir"
    582583         |         | yes       | torrent-add    | new arg "bandwidthPriority"
     584         |         | yes       | torrent-get    | new trackerStats arg "lastAnnounceTimedOut"
  • trunk/gtk/details.c

    r10082 r10099  
    16711671    const char * err_markup_begin = "<span color=\"red\">";
    16721672    const char * err_markup_end = "</span>";
     1673    const char * timeout_markup_begin = "<span color=\"#224466\">";
     1674    const char * timeout_markup_end = "</span>";
    16731675    const char * success_markup_begin = "<span color=\"#008B00\">";
    16741676    const char * success_markup_end = "</span>";
     
    16971699            tr_strltime_rounded( timebuf, now - st->lastAnnounceTime, sizeof( timebuf ) );
    16981700            if( st->lastAnnounceSucceeded )
    1699                 g_string_append_printf( gstr, _( "Got a list of %s%'d peers%s %s ago" ),
     1701                g_string_append_printf( gstr, _( "Got a list of %1$s%2$'d peers%3$s %4$s ago" ),
    17001702                                        success_markup_begin, st->lastAnnouncePeerCount, success_markup_end,
    17011703                                        timebuf );
     1704            else if( st->lastAnnounceTimedOut )
     1705                g_string_append_printf( gstr, _( "Peer list request %1$stimed out%2$s %3$s ago; will retry" ),
     1706                                        timeout_markup_begin, timeout_markup_end, timebuf );
    17021707            else
    1703                 g_string_append_printf( gstr, _( "Got an error %s\"%s\"%s %s ago" ),
    1704                                         err_markup_begin, st->lastAnnounceResult, err_markup_end,
    1705                                         timebuf );
     1708                g_string_append_printf( gstr, _( "Got an error %1$s\"%2$s\"%3$s %4$s ago" ),
     1709                                        err_markup_begin, st->lastAnnounceResult, err_markup_end, timebuf );
    17061710        }
    17071711
  • trunk/libtransmission/announcer.c

    r10096 r10099  
    4040{
    4141    /* unless the tracker says otherwise, rescrape this frequently */
    42     DEFAULT_SCRAPE_INTERVAL_SEC = ( 60 * 15 ),
     42    DEFAULT_SCRAPE_INTERVAL_SEC = ( 60 * 30 ),
    4343
    4444    /* unless the tracker says otherwise, this is the announce interval */
     
    359359    tr_bool lastScrapeSucceeded;
    360360    tr_bool lastAnnounceSucceeded;
     361    tr_bool lastAnnounceTimedOut;
    361362
    362363    time_t scrapeAt;
     
    13251326
    13261327        tier->lastAnnounceSucceeded = success;
     1328        tier->lastAnnounceTimedOut = responseCode == 0;
    13271329
    13281330        if( success )
     
    14351437            if( tr_bencDictFindDict( val, "flags", &flags ) )
    14361438                if( ( tr_bencDictFindInt( flags, "min_request_interval", &intVal ) ) )
    1437                     tier->scrapeIntervalSec = intVal;
    1438 
    1439             /* as per ticket #1045, safeguard against trackers returning
    1440              * a very low min_request_interval... */
    1441             if( tier->scrapeIntervalSec < DEFAULT_SCRAPE_INTERVAL_SEC )
    1442                 tier->scrapeIntervalSec = DEFAULT_SCRAPE_INTERVAL_SEC;
     1439                    tier->scrapeIntervalSec = MAX( DEFAULT_SCRAPE_INTERVAL_SEC, (int)intVal );
    14431440
    14441441            tr_tordbg( tier->tor,
     
    17981795                    tr_strlcpy( st->lastAnnounceResult, tier->lastAnnounceStr, sizeof( st->lastAnnounceResult ) );
    17991796                    st->lastAnnounceSucceeded = tier->lastAnnounceSucceeded;
     1797                    st->lastAnnounceTimedOut = tier->lastAnnounceTimedOut;
    18001798                    st->lastAnnouncePeerCount = tier->lastAnnouncePeerCount;
    18011799                }
  • trunk/libtransmission/rpcimpl.c

    r10092 r10099  
    376376    {
    377377        const tr_tracker_stat * s = &st[i];
    378         tr_benc * d = tr_bencListAddDict( list, 23 );
     378        tr_benc * d = tr_bencListAddDict( list, 24 );
    379379        tr_bencDictAddStr ( d, "announce", s->announce );
    380380        tr_bencDictAddInt ( d, "announceState", s->announceState );
     
    390390        tr_bencDictAddBool( d, "lastAnnounceSucceeded", s->lastAnnounceSucceeded );
    391391        tr_bencDictAddInt ( d, "lastAnnounceTime", s->lastAnnounceTime );
     392        tr_bencDictAddBool( d, "lastAnnounceTimedOut", s->lastAnnounceTimedOut );
    392393        tr_bencDictAddStr ( d, "lastScrapeResult", s->lastScrapeResult );
    393394        tr_bencDictAddInt ( d, "lastScrapeStartTime", s->lastScrapeStartTime );
  • trunk/libtransmission/transmission.h

    r10084 r10099  
    14421442    tr_bool lastAnnounceSucceeded;
    14431443
     1444    /* whether or not the last announce timed out. */
     1445    tr_bool lastAnnounceTimedOut;
     1446
    14441447    /* when the last announce was completed.
    14451448       if "hasAnnounced" is false, this field is undefined */
Note: See TracChangeset for help on using the changeset viewer.