Changeset 14075


Ignore:
Timestamp:
May 22, 2013, 7:02:07 PM (9 years ago)
Author:
jordan
Message:

(trunk, libT) #5356 'only set CURLOPT_COOKIEFILE if cookies.txt exists on startup' -- fixed.

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r13954 r14075  
    596596}
    597597
    598 static int
    599 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 int
    608 clientIsUploadingTo (const tr_peerMsgs * p)
    609 {
    610   return tr_peerMsgsIsPeerInterested (p) && !tr_peerMsgsIsPeerChoked (p);
    611 }
    612 
    613598/***
    614599****
     
    26552640      ++setmePeersFrom[atom->fromFirst];
    26562641
    2657       if (clientIsDownloadingFrom (tor, msgs))
     2642      if (tr_peerMsgsIsClientDownloading (msgs))
    26582643        ++*setmePeersSendingToUs;
    26592644
    2660       if (clientIsUploadingTo (msgs))
     2645      if (tr_peerMsgsIsPeerDownloading (msgs))
    26612646        ++*setmePeersGettingFromUs;
    26622647    }
     
    27362721      stat->clientIsInterested  = tr_peerMsgsIsClientInterested (msgs);
    27372722      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);
    27402725      stat->isSeed              = peerIsSeed (peer);
    27412726
  • trunk/libtransmission/peer-msgs.c

    r13954 r14075  
    24502450
    24512451bool
     2452tr_peerMsgsIsPeerDownloading (const tr_peerMsgs * msgs)
     2453{
     2454  assert (tr_isPeerMsgs (msgs));
     2455
     2456  return msgs->peer_is_interested && !msgs->peer_is_choked;
     2457}
     2458
     2459bool
    24522460tr_peerMsgsIsClientChoked (const tr_peerMsgs * msgs)
    24532461{
     
    24632471
    24642472  return msgs->client_is_interested;
     2473}
     2474
     2475bool
     2476tr_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);
    24652483}
    24662484
  • trunk/libtransmission/peer-msgs.h

    r13954 r14075  
    4949bool         tr_peerMsgsIsPeerInterested     (const tr_peerMsgs        * msgs);
    5050
     51bool         tr_peerMsgsIsPeerDownloading    (const tr_peerMsgs        * msgs);
     52
    5153bool         tr_peerMsgsIsClientChoked       (const tr_peerMsgs        * msgs);
    5254
    5355bool         tr_peerMsgsIsClientInterested   (const tr_peerMsgs        * msgs);
     56
     57bool         tr_peerMsgsIsClientDownloading  (const tr_peerMsgs        * msgs);
    5458
    5559time_t       tr_peerMsgsGetConnectionAge     (const tr_peerMsgs        * msgs);
  • trunk/libtransmission/web.c

    r14074 r14075  
    183183
    184184  curl_easy_setopt (e, CURLOPT_AUTOREFERER, 1L);
    185   curl_easy_setopt (e, CURLOPT_COOKIEFILE, web->cookie_filename);
    186185  curl_easy_setopt (e, CURLOPT_ENCODING, "gzip;q=1.0, deflate, identity");
    187186  curl_easy_setopt (e, CURLOPT_FOLLOWLOCATION, 1L);
     
    216215  if (task->cookies != NULL)
    217216    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);
    218220
    219221  if (task->range != NULL)
     
    371373tr_webThreadFunc (void * vsession)
    372374{
     375  char * str;
    373376  CURLM * multi;
    374377  struct tr_web * web;
     
    396399      tr_logAddNamedInfo ("web", "NB: invalid certs will show up as 'Could not connect to tracker' like many other errors");
    397400    }
    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);
    399406
    400407  multi = curl_multi_init ();
Note: See TracChangeset for help on using the changeset viewer.