Changeset 10019
- Timestamp:
- Jan 26, 2010, 7:22:50 AM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-msgs.c
r10011 r10019 1706 1706 int estimatedBlocksInPeriod; 1707 1707 double rate; 1708 const int floor = 8;1708 const int floor = 4; 1709 1709 const int seconds = REQUEST_BUF_SECS; 1710 1710 -
trunk/libtransmission/web.c
r10014 r10019 100 100 CURL * easy; 101 101 CURLM * multi; 102 tr_bool timer_event_isSet; 102 103 }; 103 104 … … 107 108 if( task->slist != NULL ) 108 109 curl_slist_free_all( task->slist ); 109 evtimer_del( &task->timer_event ); 110 if( task->timer_event_isSet ) 111 evtimer_del( &task->timer_event ); 110 112 evbuffer_free( task->response ); 111 113 tr_free( task->host ); … … 247 249 248 250 static void task_timeout_cb( int fd UNUSED, short what UNUSED, void * task ); 251 static void task_finish( struct tr_web_task * task, long response_code ); 249 252 250 253 static void … … 254 257 const tr_session * session = task->session; 255 258 256 if( session && session->web ) 259 if( ( session == NULL ) || ( session->web == NULL ) ) 260 return; 261 262 if( task->resolved_host == NULL ) 263 { 264 dbgmsg( "couldn't resolve host for \"%s\"... task failed", task->url ); 265 task_finish( task, 0 ); 266 } 267 else 257 268 { 258 269 CURL * e = curl_easy_init( ); … … 263 274 char * url = NULL; 264 275 265 /* If we've got a resolved host, insert it into the URL: replace 266 * "http://www.craptrackular.org/announce?key=val&key2=..." with 267 * "http://127.0.0.1/announce?key=val&key2=..." 268 * so that curl's DNS won't block */ 269 if( task->resolved_host != NULL ) 276 /* insert the resolved host into the URL s.t. curl's DNS won't block 277 * even if -- like on most OSes -- it wasn't built with C-Ares :( 278 * "http://www.craptrackular.org/announce?key=val&key2=..." becomes 279 * "http://127.0.0.1/announce?key=val&key2=..." */ 270 280 { 271 281 char * host; … … 280 290 evbuffer_free( buf ); 281 291 292 /* Manually add a Host: argument that refers to the true URL */ 282 293 if( ( ( task->port <= 0 ) ) || 283 294 ( ( task->port == 80 ) && !strncmp( task->url, "http://", 7 ) ) || … … 313 324 /* use our own timeout instead of CURLOPT_TIMEOUT because the latter 314 325 * doesn't play nicely with curl_multi. See curl bug #2501457 */ 326 task->timer_event_isSet = TRUE; 315 327 evtimer_set( &task->timer_event, task_timeout_cb, task ); 316 328 tr_timerAdd( &task->timer_event, timeout, 0 );
Note: See TracChangeset
for help on using the changeset viewer.