* New non-template VariableStringSlot and VariableValueSlot.

* Support B, K, M and G in options.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@670 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-04-20 20:03:03 +00:00
parent 2f6b5affd1
commit c4256079ae
15 changed files with 427 additions and 179 deletions
+13 -16
View File
@@ -65,28 +65,25 @@ Download::Download(download_type d) :
m_download.signal_chunk_failed(sigc::mem_fun(*this, &Download::receive_chunk_failed));
m_variables.insert("connection_current", new utils::VariableSlotString<const char*, const std::string&>(rak::mem_fn(this, &Download::connection_current),
rak::mem_fn(this, &Download::set_connection_current)));
m_variables.insert("connection_current", new utils::VariableStringSlot(rak::mem_fn(this, &Download::connection_current),
rak::mem_fn(this, &Download::set_connection_current)));
m_variables.insert("connection_leech", new utils::VariableAny(connection_type_to_string(download_type::CONNECTION_LEECH)));
m_variables.insert("connection_seed", new utils::VariableAny(connection_type_to_string(download_type::CONNECTION_SEED)));
m_variables.insert("state", new utils::VariableObject(bencode(), "rtorrent", "state", torrent::Object::TYPE_STRING));
m_variables.insert("tied_to_file", new utils::VariableObject(bencode(), "rtorrent", "tied_to_file", torrent::Object::TYPE_STRING));
m_variables.insert("directory", new utils::VariableSlotString<const std::string&>(rak::mem_fn(&m_fileList, &torrent::FileList::root_dir),
rak::mem_fn(this, &Download::set_root_directory)));
m_variables.insert("directory", new utils::VariableStringSlot(rak::mem_fn(&m_fileList, &torrent::FileList::root_dir),
rak::mem_fn(this, &Download::set_root_directory)));
m_variables.insert("min_peers", new utils::VariableSlotValue<uint32_t, uint32_t>(rak::mem_fn(&m_download, &download_type::peers_min),
rak::mem_fn(&m_download, &download_type::set_peers_min),
"%u"));
m_variables.insert("max_peers", new utils::VariableSlotValue<uint32_t, uint32_t>(rak::mem_fn(&m_download, &download_type::peers_max),
rak::mem_fn(&m_download, &download_type::set_peers_max),
"%u"));
m_variables.insert("max_uploads", new utils::VariableSlotValue<uint32_t, uint32_t>(rak::mem_fn(&m_download, &download_type::uploads_max),
rak::mem_fn(&m_download, &download_type::set_uploads_max),
"%u"));
m_variables.insert("priority", new utils::VariableSlotValue<uint32_t, uint32_t>(rak::mem_fn(this, &Download::priority),
rak::mem_fn(this, &Download::set_priority),
"%u"));
m_variables.insert("min_peers", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::peers_min),
rak::mem_fn(&m_download, &download_type::set_peers_min)));
m_variables.insert("max_peers", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::peers_max),
rak::mem_fn(&m_download, &download_type::set_peers_max)));
m_variables.insert("max_uploads", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::uploads_max),
rak::mem_fn(&m_download, &download_type::set_uploads_max)));
m_variables.insert("priority", new utils::VariableValueSlot(rak::mem_fn(this, &Download::priority),
rak::mem_fn(this, &Download::set_priority)));
}
Download::~Download() {
+10
View File
@@ -239,6 +239,11 @@ Manager::listen_open() {
throw torrent::input_error("Could not open/bind a port for listening: " + std::string(rak::error_number::current().c_str()));
}
std::string
Manager::bind_address() const {
return rak::socket_address::cast_from(torrent::connection_manager()->bind_address())->address_str();
}
void
Manager::set_bind_address(const std::string& addr) {
int err;
@@ -268,6 +273,11 @@ Manager::set_bind_address(const std::string& addr) {
}
}
std::string
Manager::local_address() const {
return rak::socket_address::cast_from(torrent::connection_manager()->local_address())->address_str();
}
void
Manager::set_local_address(const std::string& addr) {
int err;
+3
View File
@@ -78,7 +78,10 @@ public:
void listen_open();
std::string bind_address() const;
void set_bind_address(const std::string& addr);
std::string local_address() const;
void set_local_address(const std::string& addr);
void shutdown(bool force);