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