mirror of https://github.com/aria2/aria2
2008-05-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Call subtractPieceStats from ~PeerInteractionCommand only when the peer has at least one completed piece. * src/Peer.cc * src/Peer.h * src/PeerInteractionCommand.cc * src/PeerSessionResource.cc * src/PeerSessionResource.hpull/1/head
parent
d4d608eeb0
commit
7bbd9cec3b
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-05-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Call subtractPieceStats from ~PeerInteractionCommand only when the
|
||||||
|
peer has at least one completed piece.
|
||||||
|
* src/Peer.cc
|
||||||
|
* src/Peer.h
|
||||||
|
* src/PeerInteractionCommand.cc
|
||||||
|
* src/PeerSessionResource.cc
|
||||||
|
* src/PeerSessionResource.h
|
||||||
|
|
||||||
2008-05-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-05-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Removed unnecessary sorting
|
Removed unnecessary sorting
|
||||||
|
|
|
@ -454,4 +454,10 @@ const Time& Peer::getLastAmUnchoking() const
|
||||||
return _res->getLastAmUnchoking();
|
return _res->getLastAmUnchoking();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t Peer::getCompletedLength() const
|
||||||
|
{
|
||||||
|
assert(_res);
|
||||||
|
return _res->getCompletedLength();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -235,6 +235,8 @@ public:
|
||||||
const Time& getLastDownloadUpdate() const;
|
const Time& getLastDownloadUpdate() const;
|
||||||
|
|
||||||
const Time& getLastAmUnchoking() const;
|
const Time& getLastAmUnchoking() const;
|
||||||
|
|
||||||
|
uint64_t getCompletedLength() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SharedHandle<Peer> PeerHandle;
|
typedef SharedHandle<Peer> PeerHandle;
|
||||||
|
|
|
@ -170,8 +170,10 @@ PeerInteractionCommand::PeerInteractionCommand(int32_t cuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerInteractionCommand::~PeerInteractionCommand() {
|
PeerInteractionCommand::~PeerInteractionCommand() {
|
||||||
pieceStorage->subtractPieceStats(peer->getBitfield(),
|
if(peer->getCompletedLength() > 0) {
|
||||||
peer->getBitfieldLength());
|
pieceStorage->subtractPieceStats(peer->getBitfield(),
|
||||||
|
peer->getBitfieldLength());
|
||||||
|
}
|
||||||
peer->releaseSessionResource();
|
peer->releaseSessionResource();
|
||||||
PEER_OBJECT_CLUSTER(btContext)->unregisterHandle(peer->getID());
|
PEER_OBJECT_CLUSTER(btContext)->unregisterHandle(peer->getID());
|
||||||
|
|
||||||
|
|
|
@ -337,4 +337,9 @@ const Time& PeerSessionResource::getLastAmUnchoking() const
|
||||||
return _lastAmUnchoking;
|
return _lastAmUnchoking;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t PeerSessionResource::getCompletedLength() const
|
||||||
|
{
|
||||||
|
return _bitfieldMan->getCompletedLength();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -185,6 +185,8 @@ public:
|
||||||
const Time& getLastDownloadUpdate() const;
|
const Time& getLastDownloadUpdate() const;
|
||||||
|
|
||||||
const Time& getLastAmUnchoking() const;
|
const Time& getLastAmUnchoking() const;
|
||||||
|
|
||||||
|
uint64_t getCompletedLength() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
Loading…
Reference in New Issue