1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

tracker tweaks

This commit is contained in:
Charles Kerr 2007-08-19 00:02:23 +00:00
parent 1e53e9de72
commit b66efdf998

View file

@ -51,10 +51,10 @@
#define REQ_TIMEOUT_INTERVAL_SEC 60 #define REQ_TIMEOUT_INTERVAL_SEC 60
/* the number of peers that is our goal */ /* the number of peers that is our goal */
#define NUMWANT 50 #define NUMWANT 75
/* the length of the 'key' argument passed in tracker requests */ /* the length of the 'key' argument passed in tracker requests */
#define TR_KEY_LEN 20 #define TR_KEY_LEN 10
/** /**
@ -277,14 +277,12 @@ static int onTrackerScrapeNow( void* );
static void static void
tr_trackerScrapeSoon( Tracker * t ) tr_trackerScrapeSoon( Tracker * t )
{ {
#if 0
/* don't start more than one scrape at once for the same tracker... */ /* don't start more than one scrape at once for the same tracker... */
if( !tr_ptrArrayEmpty( t->scraping ) ) if( !tr_ptrArrayEmpty( t->scraping ) )
return; return;
if( !t->scrapeTag ) if( !t->scrapeTag )
t->scrapeTag = tr_timerNew( t->handle, onTrackerScrapeNow, t, NULL, 1000 ); t->scrapeTag = tr_timerNew( t->handle, onTrackerScrapeNow, t, NULL, 1000 );
#endif
} }
static Tracker* static Tracker*
@ -364,11 +362,10 @@ escape( char * out, const uint8_t * in, int in_len )
{ {
const uint8_t *end = in + in_len; const uint8_t *end = in + in_len;
while( in != end ) while( in != end )
// if( isalnum(*in) ) if( isalnum(*in) )
// *out++ = (char) *in++; *out++ = (char) *in++;
// else else
//out += snprintf( out, 4, "%%%02X", (unsigned int)*in++ ); out += snprintf( out, 4, "%%%02X", (unsigned int)*in++ );
out += snprintf( out, 4, "%%%02x", (unsigned int)*in++ );
*out = '\0'; *out = '\0';
} }
@ -539,10 +536,10 @@ addCommonHeaders( const Tracker * t,
tr_tracker_info_t * address = getCurrentAddress( t ); tr_tracker_info_t * address = getCurrentAddress( t );
snprintf( buf, sizeof(buf), "%s:%d", address->address, address->port ); snprintf( buf, sizeof(buf), "%s:%d", address->address, address->port );
evhttp_add_header( req->output_headers, "Host", buf ); evhttp_add_header( req->output_headers, "Host", buf );
evhttp_add_header( req->output_headers, "Connection", "close" );
evhttp_add_header( req->output_headers, "Content-Length", "0" );
evhttp_add_header( req->output_headers, "User-Agent", evhttp_add_header( req->output_headers, "User-Agent",
TR_NAME "/" LONG_VERSION_STRING ); TR_NAME "/" LONG_VERSION_STRING );
evhttp_add_header( req->output_headers, "Connection", "close" );
evhttp_add_header( req->output_headers, "Content-length", "0" );
} }
/*** /***