mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
undo previous commit's accidental inclusion of changes to peer-msgs.* and peer-mgr.c
This commit is contained in:
@@ -595,6 +595,21 @@ tr_peerMgrFree (tr_peerMgr * manager)
|
||||
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);
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
@@ -2639,10 +2654,10 @@ tr_peerMgrTorrentStats (tr_torrent * tor,
|
||||
|
||||
++setmePeersFrom[atom->fromFirst];
|
||||
|
||||
if (tr_peerMsgsIsClientDownloading (msgs))
|
||||
if (clientIsDownloadingFrom (tor, msgs))
|
||||
++*setmePeersSendingToUs;
|
||||
|
||||
if (tr_peerMsgsIsPeerDownloading (msgs))
|
||||
if (clientIsUploadingTo (msgs))
|
||||
++*setmePeersGettingFromUs;
|
||||
}
|
||||
|
||||
@@ -2720,8 +2735,8 @@ tr_peerMgrPeerStats (const tr_torrent * tor, int * setmeCount)
|
||||
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);
|
||||
|
||||
@@ -2448,14 +2448,6 @@ tr_peerMsgsIsPeerInterested (const tr_peerMsgs * msgs)
|
||||
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)
|
||||
{
|
||||
@@ -2472,16 +2464,6 @@ tr_peerMsgsIsClientInterested (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)
|
||||
{
|
||||
|
||||
@@ -48,14 +48,10 @@ bool tr_peerMsgsIsPeerChoked (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);
|
||||
|
||||
Reference in New Issue
Block a user