Changeset 7645 for trunk/libtransmission/web.c
- Timestamp:
- Jan 8, 2009, 8:35:10 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/web.c
r7557 r7645 25 25 #include "web.h" 26 26 27 enum 27 enum 28 28 { 29 29 /* arbitrary number */ 30 MAX_CONCURRENT_TASKS = 100,30 MAX_CONCURRENT_TASKS = 24, 31 31 32 32 /* arbitrary number */ 33 DEFAULT_TIMER_MSEC = 2 50033 DEFAULT_TIMER_MSEC = 2000 34 34 }; 35 35 … … 50 50 struct tr_web 51 51 { 52 tr_bool closing;52 tr_bool isClosing; 53 53 int prev_running; 54 54 int still_running; … … 56 56 CURLM * multi; 57 57 tr_session * session; 58 #if 059 58 tr_list * easy_queue; 60 #endif61 59 struct event timer_event; 62 60 }; … … 126 124 } 127 125 128 curl_easy_setopt( easy, CURLOPT_DNS_CACHE_TIMEOUT, 360 0L );129 curl_easy_setopt( easy, CURLOPT_CONNECTTIMEOUT, 120L );126 curl_easy_setopt( easy, CURLOPT_DNS_CACHE_TIMEOUT, 360L ); 127 curl_easy_setopt( easy, CURLOPT_CONNECTTIMEOUT, 60L ); 130 128 curl_easy_setopt( easy, CURLOPT_FOLLOWLOCATION, 1L ); 129 curl_easy_setopt( easy, CURLOPT_MAXREDIRS, 16L ); 131 130 curl_easy_setopt( easy, CURLOPT_NOSIGNAL, 1L ); 132 131 curl_easy_setopt( easy, CURLOPT_PRIVATE, task ); … … 145 144 curl_easy_setopt( easy, CURLOPT_ENCODING, "" ); 146 145 147 #if 0 148 if( web->still_running >= MAX_CONCURRENT_TASKS ) 149 { 146 if( web->still_running >= MAX_CONCURRENT_TASKS ) { 150 147 tr_list_append( &web->easy_queue, easy ); 151 148 dbgmsg( " >> enqueueing a task ... size is now %d", 152 149 tr_list_size( web->easy_queue ) ); 153 } 154 else 155 #endif 156 { 150 } else { 157 151 const CURLMcode rc = curl_multi_add_handle( web->multi, easy ); 158 152 if( rc == CURLM_OK ) … … 215 209 curl_easy_getinfo( easy, CURLINFO_PRIVATE, (void*)&task ); 216 210 curl_easy_getinfo( easy, CURLINFO_RESPONSE_CODE, &code ); 217 task_finish( task, code );218 211 curl_multi_remove_handle( g->multi, easy ); 219 212 curl_easy_cleanup( easy ); 213 task_finish( task, code ); 220 214 } 221 215 } … … 244 238 } 245 239 246 #if 0247 240 static void 248 241 add_tasks_from_queue( tr_web * g ) … … 265 258 } 266 259 } 267 #endif268 260 269 261 static void … … 275 267 } 276 268 277 /* note: this function can free the tr_web if its ' closing' flag is set269 /* note: this function can free the tr_web if its 'isClosing' flag is set 278 270 and no tasks remain. callers must not reference their g pointer 279 271 after calling this function */ … … 298 290 remove_finished_tasks( g ); 299 291 300 #if 0301 292 add_tasks_from_queue( g ); 302 #endif303 293 304 294 if( !g->still_running ) { 305 295 stop_timer( g ); 306 if( g-> closing ) {296 if( g->isClosing ) { 307 297 web_close( g ); 308 298 closed = TRUE; … … 477 467 web_close( web ); 478 468 else 479 web-> closing = 1;469 web->isClosing = 1; 480 470 } 481 471
Note: See TracChangeset
for help on using the changeset viewer.