diff --git a/autogen.sh b/autogen.sh index 811a2dff..24f60ca4 100755 --- a/autogen.sh +++ b/autogen.sh @@ -6,7 +6,7 @@ echo aclocal... exit 1 } -aclocal +aclocal -I . ${ACLOCAL_FLAGS} echo autoheader... (autoheader --version) < /dev/null > /dev/null 2>&1 || { diff --git a/scripts/common.m4 b/scripts/common.m4 index dbf417e3..235cad6d 100644 --- a/scripts/common.m4 +++ b/scripts/common.m4 @@ -37,19 +37,14 @@ AC_DEFUN([TORRENT_ENABLE_WERROR], [ ]) -AC_DEFUN([TORRENT_ENABLE_UNSAFE_OPTIMIZATION], [ - AC_ARG_ENABLE(unsafe-optimization, - [ --enable-unsafe-optimization - enable unsafe optimization [default=yes]], +AC_DEFUN([TORRENT_ENABLE_EXTRA_DEBUG], [ + AC_ARG_ENABLE(extra-debug, + [ --enable-extra-debug enable extra debugging checks. [default=no]], [ if test "$enableval" = "yes"; then - AC_DEFINE(USE_UNSAFE_OPTIMIZATION, 1, Enable possibly unsafe optimization techniques.) - else - AC_DEFINE(USE_UNSAFE_OPTIMIZATION, 0, Disable possibly unsafe optimization techniques.) + AC_DEFINE(USE_EXTRA_DEBUG, 1, Enable extra debugging checks.) fi - ],[ - AC_DEFINE(USE_UNSAFE_OPTIMIZATION, 0, Disable possibly unsafe optimization techniques.) - ]) + ]) ]) @@ -125,10 +120,10 @@ AC_DEFUN([TORRENT_CHECK_ALIGNED], [ AC_RUN_IFELSE( [[#include int main() { - char buf[5] = { 0, 0, 0, 0, 1 }; + char buf[8] = { 0, 0, 0, 0, 1, 0, 0, 0 }; int i; - for (i = 0; i < 4; ++i) - if (*(uint32_t*)(buf + 1) == 0) return -1; + for (i = 1; i < 4; ++i) + if (*(uint32_t*)(buf + i) == 0) return -1; return 0; } ]], diff --git a/src/core/download.cc b/src/core/download.cc index 10ed7522..93d4d859 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -116,7 +116,12 @@ Download::receive_storage_error(std::string msg) { torrent::Download::ConnectionType Download::string_to_connection_type(const std::string& name) { // Return default if the name isn't found. - return torrent::Download::CONNECTION_DEFAULT; + if (name == "default") + return torrent::Download::CONNECTION_DEFAULT; + else if (name == "seed") + return torrent::Download::CONNECTION_SEED; + else + throw std::runtime_error("Invalid connection type selected: \"" + name + "\""); } } diff --git a/src/display/utils.cc b/src/display/utils.cc index 2f1b8bb3..6fcbf27c 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -71,9 +71,9 @@ print_download_info(char* buf, unsigned int length, core::Download* d) { (double)d->get_download().get_bytes_total() / (double)(1 << 20))); buf += std::max(0, snprintf(buf, last - buf, " Rate: %5.1f / %5.1f KB Uploaded: %.1f MB", - (double)d->get_download().get_write_rate().rate() / (1 << 10), - (double)d->get_download().get_read_rate().rate() / (1 << 10), - (double)d->get_download().get_write_rate().total() / (1 << 20))); + (double)d->get_download().get_up_rate().rate() / (1 << 10), + (double)d->get_download().get_down_rate().rate() / (1 << 10), + (double)d->get_download().get_up_rate().total() / (1 << 20))); return buf; } diff --git a/src/display/window_peer_info.cc b/src/display/window_peer_info.cc index 3f7de710..02ae685a 100644 --- a/src/display/window_peer_info.cc +++ b/src/display/window_peer_info.cc @@ -91,10 +91,10 @@ WindowPeerInfo::redraw() { m_canvas->print(0, y++, "Done: %i%", done_percentage(**m_focus)); m_canvas->print(0, y++, "Rate: %5.1f/%5.1f KB Total: %.1f/%.1f MB", - (double)(*m_focus)->get_write_rate().rate() / (double)(1 << 10), - (double)(*m_focus)->get_read_rate().rate() / (double)(1 << 10), - (double)(*m_focus)->get_write_rate().total() / (double)(1 << 20), - (double)(*m_focus)->get_read_rate().total() / (double)(1 << 20)); + (double)(*m_focus)->get_up_rate().rate() / (double)(1 << 10), + (double)(*m_focus)->get_down_rate().rate() / (double)(1 << 10), + (double)(*m_focus)->get_up_rate().total() / (double)(1 << 20), + (double)(*m_focus)->get_down_rate().total() / (double)(1 << 20)); } int diff --git a/src/display/window_peer_list.cc b/src/display/window_peer_list.cc index 26560857..cfbb4a4f 100644 --- a/src/display/window_peer_list.cc +++ b/src/display/window_peer_list.cc @@ -97,8 +97,8 @@ WindowPeerList::redraw() { p.get_dns().c_str()); x += 18; - m_canvas->print(x, y, "%.1f", (double)p.get_write_rate().rate() / 1024); x += 7; - m_canvas->print(x, y, "%.1f", (double)p.get_read_rate().rate() / 1024); x += 7; + m_canvas->print(x, y, "%.1f", (double)p.get_up_rate().rate() / 1024); x += 7; + m_canvas->print(x, y, "%.1f", (double)p.get_down_rate().rate() / 1024); x += 7; m_canvas->print(x, y, "%.1f", (double)p.get_peer_rate().rate() / 1024); x += 7; m_canvas->print(x, y, "%c/%c%c/%c%c", diff --git a/src/display/window_statusbar.cc b/src/display/window_statusbar.cc index 0c901861..c7b37508 100644 --- a/src/display/window_statusbar.cc +++ b/src/display/window_statusbar.cc @@ -62,20 +62,20 @@ WindowStatusbar::redraw() { int pos = 0; char buf[128]; - if (torrent::get_write_throttle() == 0) + if (torrent::get_up_throttle() == 0) pos = snprintf(buf, 128, "off/"); else - pos = snprintf(buf, 128, "%3i/", torrent::get_write_throttle() / 1024); + pos = snprintf(buf, 128, "%3i/", torrent::get_up_throttle() / 1024); - if (torrent::get_read_throttle() == 0) + if (torrent::get_down_throttle() == 0) pos = snprintf(buf + pos, 128 - pos, "off"); else - pos = snprintf(buf + pos, 128 - pos, "%-3i", torrent::get_read_throttle() / 1024); + pos = snprintf(buf + pos, 128 - pos, "%-3i", torrent::get_down_throttle() / 1024); m_canvas->print(0, 0, "Throttle U/D: %s Rate: %5.1f / %5.1f KB Listen: %s:%i%s", buf, - (double)torrent::get_write_rate().rate() / 1024.0, - (double)torrent::get_read_rate().rate() / 1024.0, + (double)torrent::get_up_rate().rate() / 1024.0, + (double)torrent::get_down_rate().rate() / 1024.0, !torrent::get_local_address().empty() ? torrent::get_local_address().c_str() : "", (int)torrent::get_listen_port(), !torrent::get_bind_address().empty() ? (" Bind: " + torrent::get_bind_address()).c_str() : ""); diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc index 82ad997b..eb96abfa 100644 --- a/src/option_handler_rules.cc +++ b/src/option_handler_rules.cc @@ -149,12 +149,12 @@ apply_connection_seed(ui::Control* m, const std::string& arg) { void apply_global_download_rate(ui::Control* m, int arg) { - torrent::set_read_throttle(arg * 1024); + torrent::set_down_throttle(arg * 1024); } void apply_global_upload_rate(ui::Control* m, int arg) { - torrent::set_write_throttle(arg * 1024); + torrent::set_up_throttle(arg * 1024); } void diff --git a/src/ui/root.cc b/src/ui/root.cc index 12dae285..838be7fb 100644 --- a/src/ui/root.cc +++ b/src/ui/root.cc @@ -92,36 +92,36 @@ void Root::setup_keys() { m_control->get_input().push_back(&m_bindings); - m_bindings['a'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_write_throttle), 1); - m_bindings['z'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_write_throttle), -1); - m_bindings['s'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_write_throttle), 5); - m_bindings['x'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_write_throttle), -5); - m_bindings['d'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_write_throttle), 50); - m_bindings['c'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_write_throttle), -50); + m_bindings['a'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_up_throttle), 1); + m_bindings['z'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_up_throttle), -1); + m_bindings['s'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_up_throttle), 5); + m_bindings['x'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_up_throttle), -5); + m_bindings['d'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_up_throttle), 50); + m_bindings['c'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_up_throttle), -50); - m_bindings['A'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_read_throttle), 1); - m_bindings['Z'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_read_throttle), -1); - m_bindings['S'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_read_throttle), 5); - m_bindings['X'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_read_throttle), -5); - m_bindings['D'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_read_throttle), 50); - m_bindings['C'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_read_throttle), -50); + m_bindings['A'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_down_throttle), 1); + m_bindings['Z'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_down_throttle), -1); + m_bindings['S'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_down_throttle), 5); + m_bindings['X'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_down_throttle), -5); + m_bindings['D'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_down_throttle), 50); + m_bindings['C'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_down_throttle), -50); m_bindings[KEY_RESIZE] = sigc::mem_fun(m_control->get_display(), &display::Manager::adjust_layout); m_bindings['\x11'] = sigc::mem_fun(*m_control, &Control::receive_shutdown); } void -Root::receive_read_throttle(int t) { +Root::receive_down_throttle(int t) { m_windowStatusbar->mark_dirty(); - torrent::set_read_throttle(torrent::get_read_throttle() + t * 1024); + torrent::set_down_throttle(torrent::get_down_throttle() + t * 1024); } void -Root::receive_write_throttle(int t) { +Root::receive_up_throttle(int t) { m_windowStatusbar->mark_dirty(); - torrent::set_write_throttle(torrent::get_write_throttle() + t * 1024); + torrent::set_up_throttle(torrent::get_up_throttle() + t * 1024); } } diff --git a/src/ui/root.h b/src/ui/root.h index 91c31de9..6b6bafce 100644 --- a/src/ui/root.h +++ b/src/ui/root.h @@ -62,8 +62,8 @@ public: private: void setup_keys(); - void receive_read_throttle(int t); - void receive_write_throttle(int t); + void receive_down_throttle(int t); + void receive_up_throttle(int t); Control* m_control; DownloadList* m_downloadList;