From 3c884e72b4e1981c41627d2329e5f6a719893e3d Mon Sep 17 00:00:00 2001 From: Magnus Jonsson Date: Wed, 14 Jan 2004 16:22:49 +0000 Subject: [PATCH] *** empty log message *** --- docs/manual.rst | 7 ++++++- examples/client_test.cpp | 9 +++++++-- include/libtorrent/policy.hpp | 3 +++ src/policy.cpp | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/manual.rst b/docs/manual.rst index 5732836a2..4146e9341 100755 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -677,6 +677,7 @@ fields:: int load_balancing; int download_queue_length; + int upload_queue_length; int downloading_piece_index; int downloading_block_index; @@ -739,9 +740,13 @@ this member says how much *extra* free upload this peer has got. If it is a nega number it means that this was a peer from which we have got this amount of free download. -``download_queue_length`` is the number of block-requests we have sent to this peer +``download_queue_length`` is the number of piece-requests we have sent to this peer that hasn't been answered with a piece yet. +``upload_queue_length`` is the number of piece-requests we have received from this peer +that we haven't answered with a piece yet. + + You can know which piece, and which part of that piece, that is currently being downloaded from a specific peer by looking at the next four members. ``downloading_piece_index`` is the index of the piece that is currently being downloaded. diff --git a/examples/client_test.cpp b/examples/client_test.cpp index f03c618c1..564ffbb15 100755 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -282,6 +282,11 @@ int main(int argc, char* argv[]) } break; } + + if(c==' ') + { + events.pop_back(); + } } std::auto_ptr a; @@ -411,14 +416,14 @@ int main(int argc, char* argv[]) out << "___________________________________\n"; */ } -/* + for (std::deque::iterator i = events.begin(); i != events.end(); ++i) { out << *i << "\n"; } -*/ + clear(); set_cursor(0, 0); std::cout << out.str(); diff --git a/include/libtorrent/policy.hpp b/include/libtorrent/policy.hpp index 41f52751e..00cf280b4 100755 --- a/include/libtorrent/policy.hpp +++ b/include/libtorrent/policy.hpp @@ -123,6 +123,9 @@ namespace libtorrent peer_id id; // the ip/port pair this peer is or was connected on + // TODO: if this peer was discovered by a remote connection, + // set port=0 to denote that port is unknown. Later if + // this ip comes from the tracker, fill in the right port. address ip; // the time when this peer was optimistically unchoked diff --git a/src/policy.cpp b/src/policy.cpp index ea73f560a..f6d19f240 100755 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -367,6 +367,9 @@ namespace libtorrent if(i->connection) continue; if(i->banned) continue; + // TODO: Don't connect to peers that were discovered through + // remote connection, since we don't know the port. + assert(i->connected <= local_time); boost::posix_time::ptime next_connect=i->connected + boost::posix_time::seconds(2*60);