added peer_timeout and urlseed_timeout to session_settings, they control the timeout for peers and web seeds respectively. Added BitSlug to the projects page. Added more debug logging when resolving web seed hostnames. Updated documentation.

This commit is contained in:
Arvid Norberg 2006-06-28 23:27:44 +00:00
parent 991220f51a
commit 175fb8770b
12 changed files with 355 additions and 271 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2003 - 2005, Arvid Norberg
Copyright (c) 2003 - 2006, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without

BIN
docs/bitslug_thumb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because it is too large Load Diff

View File

@ -2136,6 +2136,8 @@ that will be sent to the tracker. The user-agent is a good way to identify your
int max_allowed_in_request_queue;
int max_out_request_queue;
int whole_pieces_threshold;
int peer_timeout;
int urlseed_timeout;
};
``proxy_ip`` may be a hostname or ip to a http proxy to use. If this is
@ -2184,7 +2186,7 @@ actual number of requests depends on the download rate and this number.
(popular == inverse of rarity) to be downloaded in sequence instead of in
random (rarest first) order. It can be used to tweak disk performance in
settings where the random download property is less necessary. For example, if
the threshold is 7, all pieces which 7 or more peers have, will be downloaded
the threshold is 10, all pieces which 10 or more peers have, will be downloaded
in index order.
``max_allowed_in_request_queue`` is the number of outstanding block requests
@ -2205,6 +2207,15 @@ The benefit of this is to better utilize disk caches by doing localized
accesses and also to make it easier to identify bad peers if a piece fails
the hash check.
``peer_timeout`` is the number of seconds the peer connection should
wait (for any activity on the peer connection) before closing it due
to time out. This defaults to 120 seconds, since that's what's specified
in the protocol specification. After half the time out, a keep alive message
is sent.
``urlseed_timeout`` is the same as ``peer_timeout`` but applies only to
url seeds. This value defaults to 20 seconds.
ip_filter
=========

View File

@ -34,6 +34,14 @@ MooPolice_ is a windows bittorrent client with a quite unique look.
.. _MooPolice: http://www.massaroddel.de/MooPolice/
**BitSlug**
.. image:: bitslug_thumb.png
BitSlug_ is a MacOSX cocoa client.
.. _BitSlug: http://bitslug.sourceforge.net/
**BitBuddy**
.. image:: bitbuddy_thumb.jpg

View File

@ -39,10 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
#pragma warning(push, 1)
#endif
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/bind.hpp>
#include <boost/program_options.hpp>
#include <boost/regex.hpp>

View File

@ -369,6 +369,8 @@ namespace libtorrent
// or if the extended handshake sets a limit.
int m_max_out_request_queue;
void set_timeout(int s) { m_timeout = s; }
private:
void fill_send_buffer();

View File

@ -80,13 +80,35 @@ namespace libtorrent
bool operator<(big_number const& n) const
{
for(int i = 0; i < number_size; ++i)
for (int i = 0; i < number_size; ++i)
{
if (m_number[i] < n.m_number[i]) return true;
if (m_number[i] > n.m_number[i]) return false;
}
return false;
}
big_number operator~()
{
big_number ret;
for (int i = 0; i< number_size; ++i)
ret.m_number[i] = ~m_number[i];
return ret;
}
big_number& operator &= (big_number const& n)
{
for (int i = 0; i< number_size; ++i)
m_number[i] &= n.m_number[i];
return *this;
}
big_number& operator |= (big_number const& n)
{
for (int i = 0; i< number_size; ++i)
m_number[i] |= n.m_number[i];
return *this;
}
unsigned char& operator[](int i)
{ assert(i >= 0 && i < number_size); return m_number[i]; }

View File

@ -50,10 +50,12 @@ namespace libtorrent
, tracker_maximum_response_length(1024*1024)
, piece_timeout(120)
, request_queue_time(3.f)
, sequenced_download_threshold(7)
, sequenced_download_threshold(10)
, max_allowed_in_request_queue(250)
, max_out_request_queue(200)
, whole_pieces_threshold(20)
, peer_timeout(120)
, urlseed_timeout(20)
{}
std::string proxy_ip;
@ -124,6 +126,16 @@ namespace libtorrent
// doing localized accesses and also to make it easier
// to identify bad peers if a piece fails the hash check.
int whole_pieces_threshold;
// the number of seconds to wait for any activity on
// the peer wire before closing the connectiong due
// to time out.
int peer_timeout;
// same as peer_timeout, but only applies to url-seeds.
// this is usually set lower, because web servers are
// expected to be more reliable.
int urlseed_timeout;
};
}

View File

@ -82,7 +82,7 @@ namespace libtorrent
#endif
m_ses(ses)
, m_max_out_request_queue(m_ses.m_settings.max_out_request_queue)
, m_timeout(120)
, m_timeout(m_ses.m_settings.peer_timeout)
, m_last_piece(second_clock::universal_time())
, m_packet_size(0)
, m_recv_pos(0)
@ -173,7 +173,7 @@ namespace libtorrent
#endif
m_ses(ses)
, m_max_out_request_queue(m_ses.m_settings.max_out_request_queue)
, m_timeout(120)
, m_timeout(m_ses.m_settings.peer_timeout)
, m_last_piece(second_clock::universal_time())
, m_packet_size(0)
, m_recv_pos(0)
@ -1961,7 +1961,7 @@ namespace libtorrent
bool peer_connection::has_timed_out() const
{
// TODO: the timeout should be set by an event rather
// TODO: the timeout should be called by an event
INVARIANT_CHECK;
using namespace boost::posix_time;

View File

@ -947,6 +947,11 @@ namespace libtorrent
{
INVARIANT_CHECK;
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
std::string now(to_simple_string(second_clock::universal_time()));
(*m_ses.m_logger) << now << " resolving: " << url << "\n";
#endif
std::string protocol;
std::string hostname;
int port;
@ -967,6 +972,11 @@ namespace libtorrent
detail::session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
INVARIANT_CHECK;
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
std::string now(to_simple_string(second_clock::universal_time()));
(*m_ses.m_logger) << now << " completed resolve: " << url << "\n";
#endif
std::set<std::string>::iterator i = m_resolving_web_seeds.find(url);
if (i != m_resolving_web_seeds.end()) m_resolving_web_seeds.erase(i);
@ -980,6 +990,9 @@ namespace libtorrent
m_ses.m_alerts.post_alert(
url_seed_alert(url, msg.str()));
}
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_ses.m_logger) << " ** HOSTNAME LOOKUP FAILED!**: " << url << "\n";
#endif
// the name lookup failed for the http host. Don't try
// this host again
@ -1019,6 +1032,10 @@ namespace libtorrent
}
catch (std::exception& e)
{
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_ses.m_logger) << " ** HOSTNAME LOOKUP FAILED!**: " << e.what() << "\n";
#endif
// TODO: post an error alert!
std::map<tcp::endpoint, peer_connection*>::iterator i = m_connections.find(a);
if (i != m_connections.end()) m_connections.erase(i);

View File

@ -66,6 +66,9 @@ namespace libtorrent
{
INVARIANT_CHECK;
// since this is a web seed, change the timeout
// according to the settings.
set_timeout(ses.m_settings.urlseed_timeout);
#ifdef TORRENT_VERBOSE_LOGGING
(*m_logger) << "*** web_peer_connection\n";
#endif