mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-09 11:42:33 +00:00
* Moved ConnectionList into the API and made rtorrent use it.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1010 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <torrent/tracker.h>
|
||||
#include <torrent/data/file.h>
|
||||
#include <torrent/data/file_list.h>
|
||||
#include <torrent/peer/connection_list.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "core/manager.h"
|
||||
@@ -438,12 +439,10 @@ initialize_command_download() {
|
||||
ADD_CD_VALUE_MEM_BI("max_file_size", &core::Download::file_list, &torrent::FileList::set_max_file_size, &torrent::FileList::max_file_size);
|
||||
|
||||
// Deprecated.
|
||||
ADD_CD_VALUE_MEM_BI("min_peers", &core::Download::download, &torrent::Download::set_peers_min, &torrent::Download::peers_min);
|
||||
ADD_CD_VALUE_MEM_BI("max_peers", &core::Download::download, &torrent::Download::set_peers_max, &torrent::Download::peers_max);
|
||||
ADD_CD_VALUE_MEM_BI("max_uploads", &core::Download::download, &torrent::Download::set_uploads_max, &torrent::Download::uploads_max);
|
||||
|
||||
ADD_CD_VALUE_MEM_BI("peers_min", &core::Download::download, &torrent::Download::set_peers_min, &torrent::Download::peers_min);
|
||||
ADD_CD_VALUE_MEM_BI("peers_max", &core::Download::download, &torrent::Download::set_peers_max, &torrent::Download::peers_max);
|
||||
ADD_CD_VALUE_MEM_BI("peers_min", &core::Download::connection_list, &torrent::ConnectionList::set_min_size, &torrent::ConnectionList::min_size);
|
||||
ADD_CD_VALUE_MEM_BI("peers_max", &core::Download::connection_list, &torrent::ConnectionList::set_max_size, &torrent::ConnectionList::max_size);
|
||||
ADD_CD_VALUE_MEM_BI("uploads_max", &core::Download::download, &torrent::Download::set_uploads_max, &torrent::Download::uploads_max);
|
||||
ADD_CD_VALUE_UNI("peers_connected", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::peers_connected)));
|
||||
ADD_CD_VALUE_UNI("peers_not_connected", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::peers_not_connected)));
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
typedef torrent::Download download_type;
|
||||
typedef torrent::FileList file_list_type;
|
||||
typedef torrent::TrackerList tracker_list_type;
|
||||
typedef torrent::ConnectionList connection_list_type;
|
||||
typedef download_type::ConnectionType connection_type;
|
||||
|
||||
static const int variable_hashing_stopped = 0;
|
||||
@@ -88,9 +89,12 @@ public:
|
||||
const file_list_type* c_file_list() const { return m_download.file_list(); }
|
||||
|
||||
torrent::Object* bencode() { return m_download.bencode(); }
|
||||
|
||||
tracker_list_type* tracker_list() { return m_download.tracker_list(); }
|
||||
uint32_t tracker_list_size() const { return m_download.tracker_list()->size(); }
|
||||
|
||||
connection_list_type* connection_list() { return m_download.connection_list(); }
|
||||
|
||||
const std::string& message() const { return m_message; }
|
||||
void set_message(const std::string& msg) { m_message = msg; }
|
||||
|
||||
|
||||
+3
-2
@@ -45,6 +45,7 @@
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/tracker_list.h>
|
||||
#include <torrent/data/file_list.h>
|
||||
#include <torrent/peer/connection_list.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "input/manager.h"
|
||||
@@ -293,14 +294,14 @@ void
|
||||
Download::receive_min_peers(int t) {
|
||||
m_windowDownloadStatus->mark_dirty();
|
||||
|
||||
m_download->download()->set_peers_min(std::max(m_download->download()->peers_min() + t, (uint32_t)5));
|
||||
m_download->download()->connection_list()->set_min_size(std::max(m_download->download()->connection_list()->min_size() + t, (uint32_t)5));
|
||||
}
|
||||
|
||||
void
|
||||
Download::receive_max_peers(int t) {
|
||||
m_windowDownloadStatus->mark_dirty();
|
||||
|
||||
m_download->download()->set_peers_max(std::max(m_download->download()->peers_max() + t, (uint32_t)5));
|
||||
m_download->download()->connection_list()->set_max_size(std::max(m_download->download()->connection_list()->max_size() + t, (uint32_t)5));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/hash_string.h>
|
||||
#include <torrent/peer/connection_list.h>
|
||||
#include <torrent/peer/peer_info.h>
|
||||
|
||||
#include "display/frame.h"
|
||||
@@ -61,10 +62,11 @@ ElementPeerList::ElementPeerList(core::Download* d) :
|
||||
|
||||
m_listItr = m_list.end();
|
||||
|
||||
m_download->download()->peer_list(m_list);
|
||||
std::for_each(m_download->download()->connection_list()->begin(), m_download->download()->connection_list()->end(),
|
||||
rak::bind1st(std::mem_fun<void,PList,PList::const_reference>(&PList::push_back), &m_list));
|
||||
|
||||
m_connPeerConnected = m_download->download()->signal_peer_connected(sigc::mem_fun(*this, &ElementPeerList::receive_peer_connected));
|
||||
m_connPeerDisconnected = m_download->download()->signal_peer_disconnected(sigc::mem_fun(*this, &ElementPeerList::receive_peer_disconnected));
|
||||
m_connPeerConnected = m_download->download()->connection_list()->signal_connected().connect(sigc::mem_fun(*this, &ElementPeerList::receive_peer_connected));
|
||||
m_connPeerDisconnected = m_download->download()->connection_list()->signal_disconnected().connect(sigc::mem_fun(*this, &ElementPeerList::receive_peer_disconnected));
|
||||
|
||||
m_windowList = new display::WindowPeerList(m_download, &m_list, &m_listItr);
|
||||
m_elementInfo = create_info();
|
||||
|
||||
Reference in New Issue
Block a user