mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-09 19:52:31 +00:00
Working option file, doesn't yet load from a sane place.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@449 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+15
-14
@@ -22,23 +22,24 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdexcept>
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
#include "option_handler_rules.h"
|
||||
|
||||
OptionHandlerDownloadMinPeers::~OptionHandlerDownloadMinPeers() {
|
||||
bool
|
||||
validate_download_peers(int arg) {
|
||||
return arg > 0 && arg < (1 << 16);
|
||||
}
|
||||
|
||||
void
|
||||
OptionHandlerDownloadMinPeers::process(const std::string& key, const std::string& arg) {
|
||||
int a;
|
||||
|
||||
if (std::sscanf(arg.c_str(), "%i", &a) != 1 ||
|
||||
a <= 0 ||
|
||||
a >= (1 << 16))
|
||||
throw std::runtime_error("Invalid argument for min peers \"" + arg + "\"");
|
||||
|
||||
(*m_map)[key] = sigc::bind(sigc::ptr_fun(&OptionHandlerDownloadMinPeers::apply), a);
|
||||
apply_download_min_peers(core::Download* d, int arg) {
|
||||
d->get_download().set_peers_min(arg);
|
||||
}
|
||||
|
||||
void
|
||||
apply_download_max_peers(core::Download* d, int arg) {
|
||||
d->get_download().set_peers_max(arg);
|
||||
}
|
||||
|
||||
void
|
||||
apply_download_max_uploads(core::Download* d, int arg) {
|
||||
d->get_download().set_uploads_max(arg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user