lt sync 1694

This commit is contained in:
Marcos Pinto 2007-10-25 22:20:56 +00:00
parent cbeb2c6e6c
commit 4bb1f06fd3
6 changed files with 18 additions and 8 deletions

View File

@ -357,6 +357,7 @@ namespace libtorrent
// the different priority levels
switch (piece_priority)
{
case 1: return prio;
case 2: return prio - 1;
case 3: return (std::max)(prio / 2, 1);
case 4: return (std::max)(prio / 2 - 1, 1);

View File

@ -111,6 +111,7 @@ namespace libtorrent
, initial_picker_threshold(4)
, allowed_fast_set_size(10)
, max_outstanding_disk_bytes_per_connection(64 * 1024)
, handshake_timeout(10)
#ifndef TORRENT_DISABLE_DHT
, use_dht_as_fallback(true)
#endif
@ -270,6 +271,11 @@ namespace libtorrent
// to not completely disrupt normal downloads.
int max_outstanding_disk_bytes_per_connection;
// the number of seconds to wait for a handshake
// response from a peer. If no response is received
// within this time, the peer is disconnected.
int handshake_timeout;
#ifndef TORRENT_DISABLE_DHT
// while this is true, the dht will note be used unless the
// tracker is online

View File

@ -240,8 +240,8 @@ namespace libtorrent
void parse_info_section(entry const& e);
entry extra(char const* key) const
{ return m_extra_info[key]; }
entry const* extra(char const* key) const
{ return m_extra_info.find_key(key); }
// frees parts of the metadata that isn't
// used by seeds

View File

@ -342,6 +342,10 @@ namespace libtorrent
try { if (handler) handler(ret, j); }
catch (std::exception&) {}
#ifndef NDEBUG
m_current.storage = 0;
#endif
if (j.buffer && free_buffer)
{
l.lock();

View File

@ -3000,13 +3000,12 @@ namespace libtorrent
return true;
}
// if it takes more than 5 seconds to receive
// handshake, disconnect
if (in_handshake() && d > seconds(5))
// do not stall waiting for a handshake
if (in_handshake() && d > seconds(m_ses.settings().handshake_timeout))
{
#ifdef TORRENT_VERBOSE_LOGGING
(*m_logger) << time_now_string() << " *** NO HANDSHAKE [ "
<< total_seconds(d) << " seconds ago ] ***\n";
(*m_logger) << time_now_string() << " *** NO HANDSHAKE [ waited "
<< total_seconds(d) << " seconds ] ***\n";
#endif
return true;
}

View File

@ -1526,7 +1526,7 @@ namespace libtorrent
INVARIANT_CHECK;
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_ses.m_logger) << time_now_string() << " resolving: " << url << "\n";
(*m_ses.m_logger) << time_now_string() << " resolving web seed: " << url << "\n";
#endif
m_resolving_web_seeds.insert(url);