Changeset 8893
- Timestamp:
- Aug 11, 2009, 9:31:33 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r8888 r8893 308 308 if test "x$enable_nls" = "xyes" ; then 309 309 use_nls=yes 310 IT_PROG_INTLTOOL([0. 40.0],[no-xml])310 IT_PROG_INTLTOOL([0.35.0],[no-xml]) 311 311 AC_CHECK_HEADERS([libintl.h]) 312 312 GETTEXT_PACKAGE=transmission -
trunk/libtransmission/tracker.c
r8889 r8893 49 49 50 50 /* unless the tracker says otherwise, this is the announce interval */ 51 DEFAULT_ANNOUNCE_INTERVAL_SEC = ( 60 * 4),51 DEFAULT_ANNOUNCE_INTERVAL_SEC = ( 60 * 10 ), 52 52 53 53 /* unless the tracker says otherwise, this is the announce min_interval */ … … 123 123 124 124 time_t lastScrapeTime; 125 long lastScrapeResponse;125 char lastScrapeStr[128]; 126 126 127 127 time_t lastAnnounceTime; 128 long lastAnnounceResponse;128 char lastAnnounceStr[128]; 129 129 }; 130 130 … … 421 421 dbgmsg( t->name, "tracker response: %ld", responseCode ); 422 422 tr_ndbg( t->name, "tracker response: %ld", responseCode ); 423 t->lastAnnounce Response = responseCode;423 t->lastAnnounceStr[0] = '\0'; 424 424 425 425 if( responseCode == HTTP_OK ) … … 443 443 if( tr_bencDictFindStr( &benc, "failure reason", &str ) ) 444 444 { 445 tr_strlcpy( t->lastAnnounceStr, str, sizeof( t->lastAnnounceStr ) ); 445 446 publishMessage( t, str, TR_TRACKER_ERROR ); 446 447 success = FALSE; … … 448 449 449 450 if( tr_bencDictFindStr( &benc, "warning message", &str ) ) 451 { 452 tr_strlcpy( t->lastAnnounceStr, str, sizeof( t->lastAnnounceStr ) ); 450 453 publishWarning( t, str ); 454 } 451 455 452 456 if( tr_bencDictFindInt( &benc, "interval", &i ) ) … … 505 509 publishNewPeersCompact6( t, allAreSeeds, raw, rawlen ); 506 510 } 511 512 if( !*t->lastAnnounceStr ) 513 tr_strlcpy( t->lastAnnounceStr, _( "Success" ), sizeof( t->lastAnnounceStr ) ); 507 514 } 508 515 … … 514 521 /* %1$ld - http status code, such as 404 515 522 * %2$s - human-readable explanation of the http status code */ 516 char * buf = tr_strdup_printf( _( " Tracker request failed. Got HTTP StatusCode %1$ld (%2$s)" ),523 char * buf = tr_strdup_printf( _( "Announce failed: tracker gave HTTP Response Code %1$ld (%2$s)" ), 517 524 responseCode, 518 525 tr_webGetResponseStr( responseCode ) ); 526 tr_strlcpy( t->lastAnnounceStr, buf, sizeof( t->lastAnnounceStr ) ); 519 527 publishWarning( t, buf ); 520 528 tr_free( buf ); 529 } 530 else 531 { 532 tr_strlcpy( t->lastAnnounceStr, _( "Announce failed: tracker did not respond." ), sizeof( t->lastAnnounceStr ) ); 521 533 } 522 534 … … 541 553 treat this as both a successful announce AND scrape. */ 542 554 if( scrapeFields >= 3 ) { 543 t->lastScrapeResponse = responseCode;544 555 t->lastScrapeTime = now; 545 556 t->scrapeAt = now + t->scrapeIntervalSec + t->randOffset; … … 610 621 dbgmsg( t->name, "scrape response: %ld\n", responseCode ); 611 622 tr_ndbg( t->name, "scrape response: %ld", responseCode ); 612 t->lastScrape Response = responseCode;623 t->lastScrapeStr[0] = '\0'; 613 624 614 625 if( responseCode == HTTP_OK ) … … 678 689 { 679 690 const int interval = t->scrapeIntervalSec + t->randOffset; 680 dbgmsg( t->name, "Request succeeded. Rescraping in %d seconds",681 interval );682 tr_ndbg( t->name, "Request succeeded. Rescraping in %d seconds",683 interval );684 691 t->scrapeAt = time( NULL ) + interval; 692 693 tr_strlcpy( t->lastScrapeStr, _( "Success" ), sizeof( t->lastScrapeStr ) ); 694 tr_ndbg( t->name, "Request succeeded. Rescraping in %d seconds", interval ); 685 695 } 686 696 else if( 300 <= responseCode && responseCode <= 399 ) 687 697 { 688 698 const int interval = 5; 689 dbgmsg( t->name, "Got a redirect. Retrying in %d seconds", interval );690 699 t->scrapeAt = time( NULL ) + interval; 700 701 tr_snprintf( t->lastScrapeStr, sizeof( t->lastScrapeStr ), "Got a redirect. Retrying in %d seconds", interval ); 702 tr_ndbg( t->name, "%s", t->lastScrapeStr ); 691 703 } 692 704 else 693 705 { 694 706 const int interval = t->retryScrapeIntervalSec + t->randOffset; 695 dbgmsg(696 t->name,697 "Tracker responded to scrape with %ld. Retrying in %d seconds.",698 responseCode, interval );699 707 t->retryScrapeIntervalSec *= 2; 700 708 t->scrapeAt = time( NULL ) + interval; 701 } 709 710 /* %1$ld - http status code, such as 404 711 * %2$s - human-readable explanation of the http status code */ 712 if( !responseCode ) 713 tr_strlcpy( t->lastScrapeStr, _( "Scrape failed: tracker did not respond." ), sizeof( t->lastScrapeStr ) ); 714 else 715 tr_snprintf( t->lastScrapeStr, sizeof( t->lastScrapeStr ), 716 _( "Scrape failed: tracker gave HTTP Response Code %1$ld (%2$s)" ), 717 responseCode, tr_webGetResponseStr( responseCode ) ); 718 } 719 720 dbgmsg( t->name, "%s", t->lastScrapeStr ); 702 721 } 703 722 … … 1079 1098 t->downloaderCount = -1; 1080 1099 t->leecherCount = -1; 1081 t->lastAnnounceResponse = -1;1082 t->lastScrapeResponse = -1;1083 1100 t->manualAnnounceAllowedAt = ~(time_t)0; 1084 1101 t->name = tr_strdup( info->name ); … … 1240 1257 setme->nextAnnounceTime = t->reannounceAt; 1241 1258 setme->manualAnnounceTime = t->manualAnnounceAllowedAt; 1242 1243 if( t->lastScrapeResponse == -1 ) /* never been scraped */ 1244 *setme->scrapeResponse = '\0'; 1245 else 1246 tr_snprintf( setme->scrapeResponse, 1247 sizeof( setme->scrapeResponse ), 1248 "%s (%ld)", 1249 tr_webGetResponseStr( t->lastScrapeResponse ), 1250 t->lastScrapeResponse ); 1251 1252 if( t->lastAnnounceResponse == -1 ) /* never been announced */ 1253 *setme->announceResponse = '\0'; 1254 else 1255 tr_snprintf( setme->announceResponse, 1256 sizeof( setme->announceResponse ), 1257 "%s (%ld)", 1258 tr_webGetResponseStr( t->lastAnnounceResponse ), 1259 t->lastAnnounceResponse ); 1260 } 1261 1259 tr_strlcpy( setme->scrapeResponse, t->lastScrapeStr, sizeof( setme->scrapeResponse ) ); 1260 tr_strlcpy( setme->announceResponse, t->lastAnnounceStr, sizeof( setme->announceResponse ) ); 1261 } -
trunk/libtransmission/transmission.h
r8871 r8893 1530 1530 uint64_t haveUnchecked; 1531 1531 1532 /** This is the unmodified string returned by the tracker in response 1533 to the torrent's most recent scrape request. If no request was 1534 sent or there was no response, this string is empty. */ 1535 char scrapeResponse[64]; 1536 1537 /** The unmodified string returned by the tracker in response 1538 to the torrent's most recent scrape request. If no request was 1539 sent or there was no response, this string is empty. */ 1540 char announceResponse[64]; 1532 /** 1533 * This is a human-readable string with the last scrape's results. 1534 * 1. If an http error occurred, the response code and description is given. 1535 * 2. If the tracker gave an error or warning messae, that is given. 1536 * 3. If everything went fine, "Success" is given. 1537 */ 1538 char scrapeResponse[128]; 1539 1540 /** This is a human-readable string with the last announce's results. 1541 Its contents have the same form as scrapeResponse. */ 1542 char announceResponse[128]; 1541 1543 1542 1544 /** Time the most recent scrape request was sent,
Note: See TracChangeset
for help on using the changeset viewer.