diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml
index 45d0f0bb..50606811 100644
--- a/doc/rtorrent.1.xml
+++ b/doc/rtorrent.1.xml
@@ -214,7 +214,7 @@
t | T
Initiate tracker request. Use capital T to force the
- request, ignoring the "min interval".
+ request, ignoring the "min interval" set by the tracker.
@@ -402,7 +402,7 @@
ADVANCED SETTINGS
- This list contains settings normal users shouldn't need to touch.
+ This list contains settings users shouldn't need to touch.
@@ -438,7 +438,17 @@
Number of files to simultaneously keep open. Libtorrent
dynamically opens and closes files when mapping files to
- memory.
+ memory. Defaults to 128.
+
+
+
+
+ max_open_sockets = value
+
+ Number of sockets to simultaneously keep open. This value is
+ set to be sysconf(_SC_OPEN_MAX) - 256
+ at startup. This gives the client 128 sockets to use as it
+ wishes.
diff --git a/doc/rtorrent.rc b/doc/rtorrent.rc
index fff1b9bd..9340f56e 100644
--- a/doc/rtorrent.rc
+++ b/doc/rtorrent.rc
@@ -62,7 +62,10 @@
#hash_max_tries = 10
# Max number of files to keep open simultaniously.
-#max_open_files = 100
+#max_open_files = 128
+
+# Number of sockets to simultaneously keep open.
+#max_open_sockets =
# Dump data received from trackers to the files "./tracker_dump.".
#tracker_dump = no
diff --git a/src/core/download_list.cc b/src/core/download_list.cc
index 70fbd834..92943cca 100644
--- a/src/core/download_list.cc
+++ b/src/core/download_list.cc
@@ -64,8 +64,8 @@ DownloadList::iterator
DownloadList::erase(iterator itr) {
m_slotMapErase.for_each(*itr);
- (*itr)->release_download();
torrent::download_remove((*itr)->get_hash());
+ (*itr)->release_download();
delete *itr;
return Base::erase(itr);
diff --git a/src/core/manager.cc b/src/core/manager.cc
index 9afb737e..f677b93b 100644
--- a/src/core/manager.cc
+++ b/src/core/manager.cc
@@ -80,8 +80,8 @@ Manager::initialize() {
// Currently does not call stop, might want to add a function that
// checks if we're running, and if so stop?
- m_downloadList.slot_map_close().insert("1_download_close", sigc::mem_fun(&Download::call));
m_downloadList.slot_map_close().insert("1_hash_queue_remove", sigc::mem_fun(m_hashQueue, &HashQueue::remove));
+ m_downloadList.slot_map_close().insert("2_download_close", sigc::mem_fun(&Download::call));
m_downloadList.slot_map_start().insert("1_download_start", sigc::mem_fun(&Download::start));
@@ -89,7 +89,7 @@ Manager::initialize() {
m_downloadList.slot_map_stop().insert("2_hash_resume_save", sigc::mem_fun(&Download::call));
m_downloadList.slot_map_stop().insert("3_store_save", sigc::mem_fun(m_downloadStore, &DownloadStore::save));
- m_downloadList.slot_map_finished().insert("1_download_done", sigc::bind(sigc::mem_fun(*this, &Manager::receive_download_done), false));
+ m_downloadList.slot_map_finished().insert("1_download_done", sigc::bind(sigc::mem_fun(*this, &Manager::receive_download_done), true));
m_downloadList.slot_map_finished().insert("2_receive_finished", sigc::mem_fun(&Download::receive_finished));
}
diff --git a/src/display/window_statusbar.cc b/src/display/window_statusbar.cc
index 38477329..c5bd5d60 100644
--- a/src/display/window_statusbar.cc
+++ b/src/display/window_statusbar.cc
@@ -57,6 +57,7 @@ WindowStatusbar::redraw() {
m_canvas->erase();
+ // TODO: Make a buffer with size = get_width?
int pos = 0;
char buf[128];
@@ -70,14 +71,20 @@ WindowStatusbar::redraw() {
else
pos = snprintf(buf + pos, 128 - pos, "%-3i", torrent::get_read_throttle() / 1024);
- m_canvas->print(0, 0, "Throttle U/D: %s Rate: %5.1f / %5.1f KiB Listen: %s:%i%s Handshakes: %i",
+ m_canvas->print(0, 0, "Throttle U/D: %s Rate: %5.1f / %5.1f KiB Listen: %s:%i%s",
buf,
(double)torrent::get_write_rate() / 1024.0,
(double)torrent::get_read_rate() / 1024.0,
!torrent::get_ip().empty() ? torrent::get_ip().c_str() : "",
(int)torrent::get_listen_port(),
- !torrent::get_bind().empty() ? (" Bind: " + torrent::get_bind()).c_str() : "",
- torrent::get_total_handshakes());
+ !torrent::get_bind().empty() ? (" Bind: " + torrent::get_bind()).c_str() : "");
+
+ pos = snprintf(buf, 128, "[%3i/%3i/%3i]",
+ torrent::get_total_handshakes(),
+ torrent::get_open_sockets(),
+ torrent::get_max_open_sockets());
+
+ m_canvas->print(m_canvas->get_width() - pos, 0, "%s", buf);
}
}
diff --git a/src/main.cc b/src/main.cc
index 6b5ea5b9..06a54aa6 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -147,6 +147,7 @@ initialize_option_handler(ui::Control* c, OptionHandler* optionHandler) {
optionHandler->insert("hash_interval", new OptionHandlerInt(c, &apply_hash_interval, &validate_hash_interval));
optionHandler->insert("hash_max_tries", new OptionHandlerInt(c, &apply_hash_max_tries, &validate_hash_max_tries));
optionHandler->insert("max_open_files", new OptionHandlerInt(c, &apply_max_open_files, &validate_fd));
+ optionHandler->insert("max_open_sockets", new OptionHandlerInt(c, &apply_max_open_sockets, &validate_fd));
optionHandler->insert("throttle_interval", new OptionHandlerInt(c, &apply_throttle_interval, &validate_throttle_interval));
optionHandler->insert("connection_leech", new OptionHandlerString(c, &apply_connection_leech, &validate_non_empty));
@@ -299,8 +300,10 @@ do_panic(int signum) {
#endif
if (signum == SIGBUS)
- std::cout << "A bus error might mean you ran out of diskspace." << std::endl;
+ std::cout << "A bus error propably means you ran out of diskspace." << std::endl;
+ std::cout << "TO AVOID CORRUPT DOWNLOADS, RUN \"touch\" ON ALL DOWNLOADED FILES OR INITATE HASH RECHECK WITH ^R ON ALL TORRENTS." << std::endl;
+
exit(-1);
}
diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc
index 55a07d6c..58bd9062 100644
--- a/src/option_handler_rules.cc
+++ b/src/option_handler_rules.cc
@@ -106,7 +106,7 @@ validate_hash_max_tries(int arg) {
bool
validate_fd(int arg) {
- return arg >= 10 && arg < (1 << 16);
+ return arg >= 1 && arg < (1 << 16);
}
bool
@@ -177,6 +177,11 @@ apply_max_open_files(ui::Control* m, int arg) {
torrent::set_max_open_files(arg);
}
+void
+apply_max_open_sockets(ui::Control* m, int arg) {
+ torrent::set_max_open_sockets(arg);
+}
+
void
apply_throttle_interval(ui::Control* m, int arg) {
torrent::set_throttle_interval(arg * 1000);
diff --git a/src/option_handler_rules.h b/src/option_handler_rules.h
index 3c5ddb88..4654401f 100644
--- a/src/option_handler_rules.h
+++ b/src/option_handler_rules.h
@@ -48,6 +48,8 @@ namespace ui {
class Control;
}
+// Not pretty, but it is simple and easy to modify.
+
bool validate_ip(const std::string& arg);
bool validate_directory(const std::string& arg);
bool validate_port_range(const std::string& arg);
@@ -78,6 +80,7 @@ void apply_hash_read_ahead(ui::Control* m, int arg);
void apply_hash_interval(ui::Control* m, int arg);
void apply_hash_max_tries(ui::Control* m, int arg);
void apply_max_open_files(ui::Control* m, int arg);
+void apply_max_open_sockets(ui::Control* m, int arg);
void apply_throttle_interval(ui::Control* m, int arg);
void apply_ip(ui::Control* m, const std::string& arg);