tr_free (manager);
}
+static int
+clientIsDownloadingFrom (const tr_torrent * tor, const tr_peerMsgs * p)
+{
+ if (!tr_torrentHasMetadata (tor))
+ return true;
+
+ return tr_peerMsgsIsClientInterested (p) && !tr_peerMsgsIsClientChoked (p);
+}
+
+static int
+clientIsUploadingTo (const tr_peerMsgs * p)
+{
+ return tr_peerMsgsIsPeerInterested (p) && !tr_peerMsgsIsPeerChoked (p);
+}
+
/***
****
***/
++setmePeersFrom[atom->fromFirst];
- if (tr_peerMsgsIsClientDownloading (msgs))
+ if (clientIsDownloadingFrom (tor, msgs))
++*setmePeersSendingToUs;
- if (tr_peerMsgsIsPeerDownloading (msgs))
+ if (clientIsUploadingTo (msgs))
++*setmePeersGettingFromUs;
}
stat->clientIsChoked = tr_peerMsgsIsClientChoked (msgs);
stat->clientIsInterested = tr_peerMsgsIsClientInterested (msgs);
stat->isIncoming = tr_peerMsgsIsIncomingConnection (msgs);
- stat->isDownloadingFrom = tr_peerMsgsIsClientDownloading (msgs);
- stat->isUploadingTo = tr_peerMsgsIsPeerDownloading (msgs);
+ stat->isDownloadingFrom = clientIsDownloadingFrom (tor, msgs);
+ stat->isUploadingTo = clientIsUploadingTo (msgs);
stat->isSeed = peerIsSeed (peer);
stat->blocksToPeer = tr_historyGet (&peer->blocksSentToPeer, now, CANCEL_HISTORY_SEC);
return msgs->peer_is_interested;
}
-bool
-tr_peerMsgsIsPeerDownloading (const tr_peerMsgs * msgs)
-{
- assert (tr_isPeerMsgs (msgs));
-
- return msgs->peer_is_interested && !msgs->peer_is_choked;
-}
-
bool
tr_peerMsgsIsClientChoked (const tr_peerMsgs * msgs)
{
return msgs->client_is_interested;
}
-bool
-tr_peerMsgsIsClientDownloading (const tr_peerMsgs * msgs)
-{
- assert (tr_isPeerMsgs (msgs));
-
- return msgs->client_is_interested
- && !msgs->client_is_choked
- && tr_torrentHasMetadata (msgs->torrent);
-}
-
bool
tr_peerMsgsIsUtpConnection (const tr_peerMsgs * msgs)
{
bool tr_peerMsgsIsPeerInterested (const tr_peerMsgs * msgs);
-bool tr_peerMsgsIsPeerDownloading (const tr_peerMsgs * msgs);
-
bool tr_peerMsgsIsClientChoked (const tr_peerMsgs * msgs);
bool tr_peerMsgsIsClientInterested (const tr_peerMsgs * msgs);
-bool tr_peerMsgsIsClientDownloading (const tr_peerMsgs * msgs);
-
time_t tr_peerMsgsGetConnectionAge (const tr_peerMsgs * msgs);
bool tr_peerMsgsIsUtpConnection (const tr_peerMsgs * msgs);