mirror of https://github.com/aria2/aria2
2009-05-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that POU peers are never choked in seeding. * src/BtSeederStateChoke.cc * src/BtSeederStateChoke.hpull/1/head
parent
9b9295ce4a
commit
eb0cb42c72
|
@ -1,3 +1,9 @@
|
|||
2009-05-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Fixed the bug that POU peers are never choked in seeding.
|
||||
* src/BtSeederStateChoke.cc
|
||||
* src/BtSeederStateChoke.h
|
||||
|
||||
2009-05-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Added web-seeding URI handling in addTorrent command.
|
||||
|
|
|
@ -87,6 +87,11 @@ unsigned int BtSeederStateChoke::PeerEntry::getUploadSpeed() const
|
|||
return _uploadSpeed;
|
||||
}
|
||||
|
||||
void BtSeederStateChoke::PeerEntry::disableOptUnchoking()
|
||||
{
|
||||
_peer->optUnchoking(false);
|
||||
}
|
||||
|
||||
void BtSeederStateChoke::unchoke
|
||||
(std::deque<BtSeederStateChoke::PeerEntry>& peers)
|
||||
{
|
||||
|
@ -100,11 +105,16 @@ void BtSeederStateChoke::unchoke
|
|||
_logger->info("RU: %s, ulspd=%u", (*r).getPeer()->ipaddr.c_str(),
|
||||
(*r).getUploadSpeed());
|
||||
}
|
||||
if(_round == 2 && r != peers.end()) {
|
||||
std::random_shuffle(r, peers.end(),
|
||||
*(SimpleRandomizer::getInstance().get()));
|
||||
(*r).getPeer()->optUnchoking(true);
|
||||
_logger->info("POU: %s", (*r).getPeer()->ipaddr.c_str());
|
||||
|
||||
if(_round == 2) {
|
||||
std::for_each(peers.begin(), peers.end(),
|
||||
std::mem_fun_ref(&PeerEntry::disableOptUnchoking));
|
||||
if(r != peers.end()) {
|
||||
std::random_shuffle(r, peers.end(),
|
||||
*(SimpleRandomizer::getInstance().get()));
|
||||
(*r).getPeer()->optUnchoking(true);
|
||||
_logger->info("POU: %s", (*r).getPeer()->ipaddr.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,8 @@ private:
|
|||
SharedHandle<Peer> getPeer() const;
|
||||
|
||||
unsigned int getUploadSpeed() const;
|
||||
|
||||
void disableOptUnchoking();
|
||||
};
|
||||
|
||||
void unchoke(std::deque<PeerEntry>& peers);
|
||||
|
|
Loading…
Reference in New Issue