lt sync 2676
This commit is contained in:
parent
f285f607cd
commit
e48c091764
|
@ -115,7 +115,7 @@ namespace libtorrent
|
|||
, max_outstanding_disk_bytes_per_connection(64 * 1024)
|
||||
, handshake_timeout(10)
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
, use_dht_as_fallback(true)
|
||||
, use_dht_as_fallback(false)
|
||||
#endif
|
||||
, free_torrent_hashes(true)
|
||||
, upnp_ignore_nonrouters(true)
|
||||
|
|
|
@ -38,8 +38,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#ifndef alloca
|
||||
#define alloca(s) _alloca(s)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TORRENT_DISK_STATS
|
||||
#include "libtorrent/time.hpp"
|
||||
|
|
|
@ -307,7 +307,9 @@ time_duration rpc_manager::tick()
|
|||
|
||||
if (m_next_transaction_id == m_oldest_transaction_id) return milliseconds(timeout_ms);
|
||||
|
||||
std::vector<observer_ptr > timeouts;
|
||||
std::vector<observer_ptr> timeouts;
|
||||
|
||||
time_duration ret = milliseconds(timeout_ms);
|
||||
|
||||
for (;m_next_transaction_id != m_oldest_transaction_id;
|
||||
m_oldest_transaction_id = (m_oldest_transaction_id + 1) % max_transactions)
|
||||
|
@ -321,8 +323,16 @@ time_duration rpc_manager::tick()
|
|||
time_duration diff = o->sent + milliseconds(timeout_ms) - time_now();
|
||||
if (diff > seconds(0))
|
||||
{
|
||||
if (diff < seconds(1)) return seconds(1);
|
||||
return diff;
|
||||
if (diff < seconds(1))
|
||||
{
|
||||
ret = seconds(1);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = diff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -343,7 +353,7 @@ time_duration rpc_manager::tick()
|
|||
// generate new requests. We need to swap, since the
|
||||
// destrutors may add more observers to the m_aborted_transactions
|
||||
std::vector<observer_ptr>().swap(m_aborted_transactions);
|
||||
return milliseconds(timeout_ms);
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int rpc_manager::new_transaction_id(observer_ptr o)
|
||||
|
|
|
@ -105,9 +105,9 @@ namespace libtorrent
|
|||
for (std::vector<piece_pos>::const_iterator i = m_piece_map.begin() + m_cursor
|
||||
, end(m_piece_map.end()); i != end && (i->have() || i->filtered());
|
||||
++i, ++m_cursor);
|
||||
for (std::vector<piece_pos>::const_iterator i = m_piece_map.begin()
|
||||
+ m_reverse_cursor - 1; m_reverse_cursor > 0 && (i->have() || i->filtered());
|
||||
--i, --m_reverse_cursor);
|
||||
for (std::vector<piece_pos>::const_reverse_iterator i = m_piece_map.rend()
|
||||
- m_reverse_cursor; m_reverse_cursor > 0 && (i->have() || i->filtered());
|
||||
++i, --m_reverse_cursor);
|
||||
|
||||
// the piece index is stored in 20 bits, which limits the allowed
|
||||
// number of pieces somewhat
|
||||
|
@ -338,8 +338,8 @@ namespace libtorrent
|
|||
index = num_pieces;
|
||||
if (num_pieces > 0)
|
||||
{
|
||||
for (std::vector<piece_pos>::const_iterator i = m_piece_map.begin()
|
||||
+ (index - 1); index > 0 && (i->have() || i->filtered()); --i, --index);
|
||||
for (std::vector<piece_pos>::const_reverse_iterator i = m_piece_map.rend()
|
||||
- index; index > 0 && (i->have() || i->filtered()); ++i, --index);
|
||||
TORRENT_ASSERT(index == num_pieces
|
||||
|| m_piece_map[index].have()
|
||||
|| m_piece_map[index].filtered());
|
||||
|
|
|
@ -754,14 +754,10 @@ namespace libtorrent
|
|||
|
||||
m_progress = j.piece / float(torrent_file().num_pieces());
|
||||
|
||||
//m_picker->check_invariant();
|
||||
|
||||
TORRENT_ASSERT(m_picker);
|
||||
if (j.offset >= 0 && !m_picker->have_piece(j.offset))
|
||||
m_picker->we_have(j.offset);
|
||||
|
||||
//m_picker->check_invariant();
|
||||
|
||||
// we're not done checking yet
|
||||
// this handler will be called repeatedly until
|
||||
// we're done, or encounter a failure
|
||||
|
|
Loading…
Reference in New Issue