Fixed bug that cause exception to be thrown when erasing a download.

Moved to using SocketAddress within src/net.

Enabled SocketManager.

Changed API to use uint32_t instead of int.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@485 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-07-04 16:14:13 +00:00
parent 0588e66eaf
commit fc8ca7df20
8 changed files with 43 additions and 12 deletions
+13 -3
View File
@@ -214,7 +214,7 @@
<term>t | T</term>
<listitem><para>
Initiate tracker request. Use capital T to force the
request, ignoring the "min interval".
request, ignoring the "min interval" set by the tracker.
</para></listitem>
</varlistentry>
@@ -402,7 +402,7 @@
<refsect1>
<title>ADVANCED SETTINGS</title>
<para>
This list contains settings normal users shouldn't need to touch.
This list contains settings users shouldn't need to touch.
</para>
<variablelist>
@@ -438,7 +438,17 @@
<listitem><para>
Number of files to simultaneously keep open. Libtorrent
dynamically opens and closes files when mapping files to
memory.
memory. Defaults to 128.
</para></listitem>
</varlistentry>
<varlistentry>
<term>max_open_sockets = <replaceable>value</replaceable></term>
<listitem><para>
Number of sockets to simultaneously keep open. This value is
set to be <emphasis>sysconf(_SC_OPEN_MAX) - 256</emphasis>
at startup. This gives the client 128 sockets to use as it
wishes.
</para></listitem>
</varlistentry>
+4 -1
View File
@@ -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 = <no default>
# Dump data received from trackers to the files "./tracker_dump.<time>".
#tracker_dump = no
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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<void, &torrent::Download::close>));
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<void, &torrent::Download::close>));
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<void, &torrent::Download::hash_resume_save>));
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));
}
+10 -3
View File
@@ -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() : "<default>",
(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);
}
}
+4 -1
View File
@@ -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);
}
+6 -1
View File
@@ -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);
+3
View File
@@ -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);