Changeset 4066
- Timestamp:
- Dec 5, 2007, 2:09:12 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9x/libtransmission/tracker.c
r4037 r4066 382 382 } 383 383 384 static void 385 onTrackerResponse( struct evhttp_request * req, void * torrent_hash ) 384 static void onReqDone( tr_handle * handle ); 385 386 static void 387 onTrackerResponse( struct evhttp_request * req, void * vhash ) 386 388 { 387 389 const char * warning; 388 tr_tracker * t;389 390 int responseCode; 390 391 t = findTrackerFromHash( torrent_hash ); 391 struct torrent_hash * torrent_hash = (struct torrent_hash*) vhash; 392 tr_tracker * t = findTrackerFromHash( torrent_hash ); 393 394 onReqDone( torrent_hash->handle ); 392 395 tr_free( torrent_hash ); 396 393 397 if( t == NULL ) /* tracker has been closed */ 394 398 return; … … 542 546 const char * warning; 543 547 time_t nextScrapeSec = 60; 544 tr_tracker * t = findTrackerFromHash( vhash ); 548 struct torrent_hash * torrent_hash = (struct torrent_hash*) vhash; 549 tr_tracker * t = findTrackerFromHash( torrent_hash ); 550 551 onReqDone( torrent_hash->handle ); 552 tr_free( torrent_hash ); 545 553 546 554 dbgmsg( t, "Got scrape response for '%s': %s (%d)", (t ? t->name : "(null)"), (req ? req->response_code_line : "(no line)"), (req ? req->response_code : -1) ); 547 555 548 tr_free( vhash );549 556 if( t == NULL ) /* tracker's been closed... */ 550 557 return; … … 742 749 req->req = evhttp_request_new( onScrapeResponse, torrentHashNew( handle, tracker ) ); 743 750 req->reqtype = TR_REQ_SCRAPE; 744 asprintf( &req->uri, "%s%cinfo_hash=%s", a->scrape, strchr(a->scrape,'?')?'&':'?', tracker->escaped );751 tr_asprintf( &req->uri, "%s%cinfo_hash=%s", a->scrape, strchr(a->scrape,'?')?'&':'?', tracker->escaped ); 745 752 memcpy( req->torrent_hash, tracker->hash, SHA_DIGEST_LENGTH ); 746 753 addCommonHeaders( tracker, req->req ); … … 820 827 tr_handle * handle = vhandle; 821 828 822 assert( handle );823 assert( handle->tracker );824 825 829 /* libevent references evcon right after calling this function, 826 830 so we can't free it yet... defer it to after this call chain 827 831 has played out */ 828 832 tr_timerNew( handle, freeConnection, evcon, 100 ); 829 830 --handle->tracker->socketCount;831 dbgmsg( NULL, "decrementing socket count to %d", handle->tracker->socketCount );832 pulse( handle );833 833 } 834 834 … … 932 932 } 933 933 934 static void 935 onReqDone( tr_handle * handle ) 936 { 937 pulse( handle ); 938 --handle->tracker->socketCount; 939 dbgmsg( NULL, "decrementing socket count to %d", handle->tracker->socketCount ); 940 } 941 934 942 /*** 935 943 **** LIFE CYCLE
Note: See TracChangeset
for help on using the changeset viewer.