cleaned up policy. Moved logic from policy to torrent

This commit is contained in:
Arvid Norberg
2009-07-23 04:38:52 +00:00
parent 7445874028
commit 137d2d63f5
9 changed files with 234 additions and 268 deletions

View File

@@ -252,6 +252,7 @@ namespace libtorrent
{ return m_connections.size(); }
void unchoke_peer(peer_connection& c);
void choke_peer(peer_connection& c);
session_status status() const;
void set_peer_id(peer_id const& id);

View File

@@ -415,7 +415,7 @@ namespace libtorrent
// the following functions appends messages
// to the send buffer
void send_choke();
bool send_choke();
bool send_unchoke();
void send_interested();
void send_not_interested();

View File

@@ -93,15 +93,6 @@ namespace libtorrent
// the peer has got at least one interesting piece
void peer_is_interesting(peer_connection& c);
// the peer unchoked us
void unchoked(peer_connection& c);
// the peer is interested in our pieces
void interested(peer_connection& c);
// the peer is not interested in our pieces
void not_interested(peer_connection& c);
void ip_filter_updated();
void set_seed(policy::peer* p, bool s);
@@ -355,10 +346,6 @@ namespace libtorrent
torrent* m_torrent;
// free download we have got that hasn't
// been distributed yet.
size_type m_available_free_upload;
// The number of peers in our peer list
// that are connect candidates. i.e. they're
// not already connected and they have not

View File

@@ -321,7 +321,7 @@ namespace libtorrent
bool free_upload_slots() const
{ return m_num_uploads < m_max_uploads; }
void choke_peer(peer_connection& c);
bool choke_peer(peer_connection& c);
bool unchoke_peer(peer_connection& c);
// used by peer_connection to attach itself to a torrent
@@ -621,6 +621,8 @@ namespace libtorrent
// --------------------------------------------
// RESOURCE MANAGEMENT
void add_free_upload(int diff) { m_available_free_upload += diff; }
void set_peer_upload_limit(tcp::endpoint ip, int limit);
void set_peer_download_limit(tcp::endpoint ip, int limit);
@@ -909,6 +911,10 @@ namespace libtorrent
// m_num_verified = m_verified.count()
int m_num_verified;
// free download we have got that hasn't
// been distributed yet.
size_type m_available_free_upload;
// determines the storage state for this torrent.
storage_mode_t m_storage_mode;