Changeset 2885
- Timestamp:
- Aug 20, 2007, 11:37:08 PM (15 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/tracker.c
r2876 r2885 533 533 assert( t->addressIndex >= 0 ); 534 534 assert( t->addressIndex < t->addressCount ); 535 535 536 return &t->addresses[t->addressIndex]; 536 537 } 538 static int 539 trackerSupportsScrape( const Tracker * t ) 540 { 541 const tr_tracker_info_t * info = getCurrentAddress( t ); 542 543 return ( info != NULL ) 544 && ( info->scrape != NULL ) 545 && ( info->scrape[0] != '\0' ); 546 } 547 537 548 538 549 static void … … 560 571 { 561 572 Torrent * tor = (Torrent *) vtor; 562 tr_ptrArrayInsertSorted( tor->tracker->scrapeQueue, tor, torrentCompare ); 563 tr_trackerScrapeSoon( tor->tracker ); 573 if( trackerSupportsScrape( tor->tracker ) ) { 574 tr_ptrArrayInsertSorted( tor->tracker->scrapeQueue, tor, torrentCompare ); 575 tr_trackerScrapeSoon( tor->tracker ); 576 } 564 577 tor->scrapeTag = NULL; 565 578 return FALSE; … … 679 692 { 680 693 Tracker * t = (Tracker*) vt; 694 const tr_tracker_info_t * address = getCurrentAddress( t ); 681 695 682 696 assert( tr_ptrArrayEmpty( t->scraping ) ); 683 697 684 if( !tr_ptrArrayEmpty( t->scrapeQueue ) )698 if( trackerSupportsScrape( t ) && !tr_ptrArrayEmpty( t->scrapeQueue ) ) 685 699 { 686 700 int i, n, len, addr_len, ask_n; … … 690 704 struct evhttp_connection *evcon = NULL; 691 705 struct evhttp_request *req = NULL; 692 const tr_tracker_info_t * address = getCurrentAddress( t );693 706 694 707 ask_n = n; -
trunk/libtransmission/trevent.c
r2876 r2885 13 13 #include <assert.h> 14 14 #include <errno.h> 15 #include <stdio.h>16 15 #include <stdlib.h> 17 16 #include <string.h> … … 36 35 /* #define DEBUG */ 37 36 #ifdef DEBUG 37 #include <stdio.h> 38 38 #undef tr_dbg 39 39 #define tr_dbg( a, b... ) fprintf(stderr, a "\n", ##b ) … … 47 47 { 48 48 int fds[2]; 49 int isShuttingDown;50 49 tr_lock_t * lock; 51 50 tr_handle_t * h; 51 struct event_base * base; 52 52 struct event pipeEvent; 53 53 } … … 139 139 tr_dbg( "Starting libevent thread" ); 140 140 141 e vent_init( );141 eh->base = event_init( ); 142 142 event_set_log_callback( logFunc ); 143 143 … … 146 146 event_add( &eh->pipeEvent, NULL ); 147 147 148 while( !eh->isShuttingDown ) { 149 event_dispatch( ); 150 tr_wait( 50 ); /* 1/20th of a second */ 151 } 148 event_dispatch( ); 152 149 153 150 event_del( &eh->pipeEvent ); 154 151 tr_lockFree( eh->lock ); 152 event_base_free( eh->base ); 155 153 tr_free( eh ); 156 154 … … 176 174 tr_event_handle_t * eh = handle->events; 177 175 178 e h->isShuttingDown = TRUE;176 event_base_loopexit( eh->base, NULL ); 179 177 } 180 178
Note: See TracChangeset
for help on using the changeset viewer.