* Renamed read/write stuff to down/up.

* Adding incomplete PeerConnectionSeed.

* For every new peer connection it would traverse the local bitfield
to check if it was zero'ed, instead of using a cached value. Forgot to
change over when changing it from the BitFieldExt to the normal class.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@547 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-08-29 18:39:34 +00:00
parent a28ed1c96b
commit 2a1f3e12cc
10 changed files with 50 additions and 50 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ echo aclocal...
exit 1
}
aclocal
aclocal -I . ${ACLOCAL_FLAGS}
echo autoheader...
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
+8 -13
View File
@@ -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 <inttypes.h>
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;
}
]],
+6 -1
View File
@@ -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 + "\"");
}
}
+3 -3
View File
@@ -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;
}
+4 -4
View File
@@ -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
+2 -2
View File
@@ -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",
+6 -6
View File
@@ -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() : "<default>",
(int)torrent::get_listen_port(),
!torrent::get_bind_address().empty() ? (" Bind: " + torrent::get_bind_address()).c_str() : "");
+2 -2
View File
@@ -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
+16 -16
View File
@@ -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);
}
}
+2 -2
View File
@@ -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;