Changeset 14075
- Timestamp:
- May 22, 2013, 7:02:07 PM (10 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr.c
r13954 r14075 596 596 } 597 597 598 static int599 clientIsDownloadingFrom (const tr_torrent * tor, const tr_peerMsgs * p)600 {601 if (!tr_torrentHasMetadata (tor))602 return true;603 604 return tr_peerMsgsIsClientInterested (p) && !tr_peerMsgsIsClientChoked (p);605 }606 607 static int608 clientIsUploadingTo (const tr_peerMsgs * p)609 {610 return tr_peerMsgsIsPeerInterested (p) && !tr_peerMsgsIsPeerChoked (p);611 }612 613 598 /*** 614 599 **** … … 2655 2640 ++setmePeersFrom[atom->fromFirst]; 2656 2641 2657 if ( clientIsDownloadingFrom (tor,msgs))2642 if (tr_peerMsgsIsClientDownloading (msgs)) 2658 2643 ++*setmePeersSendingToUs; 2659 2644 2660 if ( clientIsUploadingTo(msgs))2645 if (tr_peerMsgsIsPeerDownloading (msgs)) 2661 2646 ++*setmePeersGettingFromUs; 2662 2647 } … … 2736 2721 stat->clientIsInterested = tr_peerMsgsIsClientInterested (msgs); 2737 2722 stat->isIncoming = tr_peerMsgsIsIncomingConnection (msgs); 2738 stat->isDownloadingFrom = clientIsDownloadingFrom (tor,msgs);2739 stat->isUploadingTo = clientIsUploadingTo(msgs);2723 stat->isDownloadingFrom = tr_peerMsgsIsClientDownloading (msgs); 2724 stat->isUploadingTo = tr_peerMsgsIsPeerDownloading (msgs); 2740 2725 stat->isSeed = peerIsSeed (peer); 2741 2726 -
trunk/libtransmission/peer-msgs.c
r13954 r14075 2450 2450 2451 2451 bool 2452 tr_peerMsgsIsPeerDownloading (const tr_peerMsgs * msgs) 2453 { 2454 assert (tr_isPeerMsgs (msgs)); 2455 2456 return msgs->peer_is_interested && !msgs->peer_is_choked; 2457 } 2458 2459 bool 2452 2460 tr_peerMsgsIsClientChoked (const tr_peerMsgs * msgs) 2453 2461 { … … 2463 2471 2464 2472 return msgs->client_is_interested; 2473 } 2474 2475 bool 2476 tr_peerMsgsIsClientDownloading (const tr_peerMsgs * msgs) 2477 { 2478 assert (tr_isPeerMsgs (msgs)); 2479 2480 return msgs->client_is_interested 2481 && !msgs->client_is_choked 2482 && tr_torrentHasMetadata (msgs->torrent); 2465 2483 } 2466 2484 -
trunk/libtransmission/peer-msgs.h
r13954 r14075 49 49 bool tr_peerMsgsIsPeerInterested (const tr_peerMsgs * msgs); 50 50 51 bool tr_peerMsgsIsPeerDownloading (const tr_peerMsgs * msgs); 52 51 53 bool tr_peerMsgsIsClientChoked (const tr_peerMsgs * msgs); 52 54 53 55 bool tr_peerMsgsIsClientInterested (const tr_peerMsgs * msgs); 56 57 bool tr_peerMsgsIsClientDownloading (const tr_peerMsgs * msgs); 54 58 55 59 time_t tr_peerMsgsGetConnectionAge (const tr_peerMsgs * msgs); -
trunk/libtransmission/web.c
r14074 r14075 183 183 184 184 curl_easy_setopt (e, CURLOPT_AUTOREFERER, 1L); 185 curl_easy_setopt (e, CURLOPT_COOKIEFILE, web->cookie_filename);186 185 curl_easy_setopt (e, CURLOPT_ENCODING, "gzip;q=1.0, deflate, identity"); 187 186 curl_easy_setopt (e, CURLOPT_FOLLOWLOCATION, 1L); … … 216 215 if (task->cookies != NULL) 217 216 curl_easy_setopt (e, CURLOPT_COOKIE, task->cookies); 217 218 if (web->cookie_filename != NULL) 219 curl_easy_setopt (e, CURLOPT_COOKIEFILE, web->cookie_filename); 218 220 219 221 if (task->range != NULL) … … 371 373 tr_webThreadFunc (void * vsession) 372 374 { 375 char * str; 373 376 CURLM * multi; 374 377 struct tr_web * web; … … 396 399 tr_logAddNamedInfo ("web", "NB: invalid certs will show up as 'Could not connect to tracker' like many other errors"); 397 400 } 398 web->cookie_filename = tr_buildPath (session->configDir, "cookies.txt", NULL); 401 402 str = tr_buildPath (session->configDir, "cookies.txt", NULL); 403 if (tr_fileExists (str, NULL)) 404 web->cookie_filename = tr_strdup (str); 405 tr_free (str); 399 406 400 407 multi = curl_multi_init ();
Note: See TracChangeset
for help on using the changeset viewer.