mirror of https://github.com/aria2/aria2
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added BtSeederStateChoke::PeerEntry::swap(). Also added non-member swap for it, which is friend function for BtSeederStateChoke because PeerEntry is private. * src/BtSeederStateChoke.cc * src/BtSeederStateChoke.hpull/1/head
parent
8f46dbc0ab
commit
752234ae66
|
@ -1,3 +1,11 @@
|
||||||
|
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Added BtSeederStateChoke::PeerEntry::swap(). Also added
|
||||||
|
non-member swap for it, which is friend function for
|
||||||
|
BtSeederStateChoke because PeerEntry is private.
|
||||||
|
* src/BtSeederStateChoke.cc
|
||||||
|
* src/BtSeederStateChoke.h
|
||||||
|
|
||||||
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Added BtLeecherStateChoke::PeerEntry::swap(). Also added
|
Added BtLeecherStateChoke::PeerEntry::swap(). Also added
|
||||||
|
|
|
@ -71,6 +71,16 @@ BtSeederStateChoke::PeerEntry::PeerEntry(const PeerEntry& c)
|
||||||
|
|
||||||
BtSeederStateChoke::PeerEntry::~PeerEntry() {}
|
BtSeederStateChoke::PeerEntry::~PeerEntry() {}
|
||||||
|
|
||||||
|
void BtSeederStateChoke::PeerEntry::swap(PeerEntry& c)
|
||||||
|
{
|
||||||
|
using std::swap;
|
||||||
|
swap(peer_, c.peer_);
|
||||||
|
swap(outstandingUpload_, c.outstandingUpload_);
|
||||||
|
swap(lastAmUnchoking_, c.lastAmUnchoking_);
|
||||||
|
swap(recentUnchoking_, c.recentUnchoking_);
|
||||||
|
swap(uploadSpeed_, c.uploadSpeed_);
|
||||||
|
}
|
||||||
|
|
||||||
BtSeederStateChoke::PeerEntry& BtSeederStateChoke::PeerEntry::operator=
|
BtSeederStateChoke::PeerEntry& BtSeederStateChoke::PeerEntry::operator=
|
||||||
(const PeerEntry& c)
|
(const PeerEntry& c)
|
||||||
{
|
{
|
||||||
|
@ -176,4 +186,21 @@ BtSeederStateChoke::executeChoke
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void swap
|
||||||
|
(BtSeederStateChoke::PeerEntry& a,
|
||||||
|
BtSeederStateChoke::PeerEntry& b)
|
||||||
|
{
|
||||||
|
a.swap(b);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
template<>
|
||||||
|
void swap<aria2::BtSeederStateChoke::PeerEntry>
|
||||||
|
(aria2::BtSeederStateChoke::PeerEntry& a,
|
||||||
|
aria2::BtSeederStateChoke::PeerEntry& b)
|
||||||
|
{
|
||||||
|
a.swap(b);
|
||||||
|
}
|
||||||
|
} // namespace std
|
||||||
|
|
|
@ -66,6 +66,8 @@ private:
|
||||||
PeerEntry(const PeerEntry& c);
|
PeerEntry(const PeerEntry& c);
|
||||||
~PeerEntry();
|
~PeerEntry();
|
||||||
|
|
||||||
|
void swap(PeerEntry& c);
|
||||||
|
|
||||||
PeerEntry& operator=(const PeerEntry& c);
|
PeerEntry& operator=(const PeerEntry& c);
|
||||||
|
|
||||||
bool operator<(const PeerEntry& rhs) const;
|
bool operator<(const PeerEntry& rhs) const;
|
||||||
|
@ -99,8 +101,22 @@ public:
|
||||||
void executeChoke(const std::vector<SharedHandle<Peer> >& peerSet);
|
void executeChoke(const std::vector<SharedHandle<Peer> >& peerSet);
|
||||||
|
|
||||||
const Timer& getLastRound() const { return lastRound_; }
|
const Timer& getLastRound() const { return lastRound_; }
|
||||||
|
|
||||||
|
friend void swap(PeerEntry& a, PeerEntry& b);
|
||||||
|
friend void std::swap<PeerEntry>(PeerEntry& a, PeerEntry& b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void swap
|
||||||
|
(BtSeederStateChoke::PeerEntry& a,
|
||||||
|
BtSeederStateChoke::PeerEntry& b);
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
template<>
|
||||||
|
void swap<aria2::BtSeederStateChoke::PeerEntry>
|
||||||
|
(aria2::BtSeederStateChoke::PeerEntry& a,
|
||||||
|
aria2::BtSeederStateChoke::PeerEntry& b);
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
#endif // D_BT_SEEDER_STATE_CHOKE_H
|
#endif // D_BT_SEEDER_STATE_CHOKE_H
|
||||||
|
|
Loading…
Reference in New Issue