forked from premiere/premiere-libtorrent
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:
parent
991220f51a
commit
175fb8770b
2
COPYING
2
COPYING
|
@ -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
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
517
docs/manual.html
517
docs/manual.html
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||
=========
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -88,6 +88,28 @@ namespace libtorrent
|
|||
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]; }
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -968,6 +973,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 << " 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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue