*** empty log message ***

This commit is contained in:
Arvid Norberg
2003-12-08 16:39:05 +00:00
parent dced8aa172
commit d99762f0b0
5 changed files with 19 additions and 7 deletions

View File

@@ -569,6 +569,7 @@ fields::
peer_id id; peer_id id;
std::vector<bool> pieces; std::vector<bool> pieces;
int upload_limit; int upload_limit;
int upload_ceiling;
}; };
The ``flags`` attribute tells you in which state the peer is. It is set to The ``flags`` attribute tells you in which state the peer is. It is set to
@@ -600,6 +601,9 @@ or if the peer miss that piece (set to false).
peer every second. It may be -1 if there's no limit. The upload limits of all peers peer every second. It may be -1 if there's no limit. The upload limits of all peers
should sum up to the upload limit set by ``session::set_upload_limit``. should sum up to the upload limit set by ``session::set_upload_limit``.
``upload_ceiling`` is the current maximum allowed upload rate given the cownload
rate and share ratio. If the global upload rate is inlimited, the ``upload_limit``
for every peer will be the same as their ``upload_ceiling``.
get_torrent_info() get_torrent_info()
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@@ -75,7 +75,7 @@ void clear()
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
COORD c = {0, 0}; COORD c = {0, 0};
DWORD n; DWORD n;
FillConsoleOutputCharacter(h, ' ', 80 * 50, c, &n); FillConsoleOutputCharacter(h, ' ', 80 * 80, c, &n);
} }
#else #else
@@ -197,7 +197,7 @@ int main(int argc, char* argv[])
entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>()); entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());
torrent_info t(e); torrent_info t(e);
t.print(std::cout); t.print(std::cout);
handles.push_back(s.add_torrent(t, boost::filesystem::path("", boost::filesystem::native))); handles.push_back(s.add_torrent(t, ""));
} }
catch (std::exception& e) catch (std::exception& e)
{ {
@@ -256,6 +256,9 @@ int main(int argc, char* argv[])
% add_suffix(total_up) % add_suffix(total_up)
% add_suffix(up); % add_suffix(up);
*/ */
std::cout.precision(4);
std::cout.width(5);
std::cout.fill(' ');
std::cout << (s.progress*100) << "% "; std::cout << (s.progress*100) << "% ";
for (int i = 0; i < 50; ++i) for (int i = 0; i < 50; ++i)
{ {
@@ -279,10 +282,13 @@ int main(int argc, char* argv[])
i != peers.end(); i != peers.end();
++i) ++i)
{ {
std::cout << "d: " << add_suffix(i->down_speed) << "/s (" << add_suffix(i->total_download) std::cout << "d: " << add_suffix(i->down_speed) << "/s "
<< ") u: " << add_suffix(i->up_speed) << "/s (" << add_suffix(i->total_upload) << "(" << add_suffix(i->total_download) << ") "
<< ") df: " << add_suffix((int)i->total_download - (int)i->total_upload) << "u: " << add_suffix(i->up_speed) << "/s "
<< " f: " << "(" << add_suffix(i->total_upload) << ") "
<< "df: " << add_suffix((int)i->total_download - (int)i->total_upload) << " "
<< "l: " << add_suffix(i->upload_ceiling) << "/s "
<< "f: "
<< static_cast<const char*>((i->flags & peer_info::interesting)?"I":"_") << static_cast<const char*>((i->flags & peer_info::interesting)?"I":"_")
<< static_cast<const char*>((i->flags & peer_info::choked)?"C":"_") << static_cast<const char*>((i->flags & peer_info::choked)?"C":"_")
<< static_cast<const char*>((i->flags & peer_info::remote_interested)?"i":"_") << static_cast<const char*>((i->flags & peer_info::remote_interested)?"i":"_")

View File

@@ -57,6 +57,7 @@ namespace libtorrent
peer_id id; peer_id id;
std::vector<bool> pieces; std::vector<bool> pieces;
int upload_limit; int upload_limit;
int upload_ceiling;
}; };
} }

View File

@@ -352,7 +352,7 @@ namespace libtorrent
{ {
// if we're interested in the peer, we unchoke it // if we're interested in the peer, we unchoke it
// and hopes it will unchoke us too // and hopes it will unchoke us too
if (c.is_interesting) c.unchoke(); if (c.is_interesting()) c.unchoke();
} }
void policy::not_interested(peer_connection& c) void policy::not_interested(peer_connection& c)

View File

@@ -209,6 +209,7 @@ namespace libtorrent
p.total_upload = statistics.total_upload(); p.total_upload = statistics.total_upload();
p.upload_limit = peer->send_quota(); p.upload_limit = peer->send_quota();
p.upload_ceiling = peer->send_quota_limit();
p.flags = 0; p.flags = 0;
if (peer->is_interesting()) p.flags |= peer_info::interesting; if (peer->is_interesting()) p.flags |= peer_info::interesting;