forked from premiere/premiere-libtorrent
completed fast reconnect fix
This commit is contained in:
parent
82369a552b
commit
2940d253c3
|
@ -375,7 +375,7 @@ namespace libtorrent
|
|||
int m_sync_bytes_read;
|
||||
|
||||
// hold information about latest allocated send buffer
|
||||
// need to check for non zero (begin, end) for operations with this
|
||||
// need to check for non zero (begin, end) for operations with this
|
||||
buffer::interval m_enc_send_buffer;
|
||||
|
||||
// initialized during write_pe1_2_dhkey, and destroyed on
|
||||
|
|
|
@ -176,6 +176,9 @@ namespace libtorrent
|
|||
void set_non_prioritized(bool b)
|
||||
{ m_non_prioritized = b; }
|
||||
|
||||
void fast_reconnect(bool r) { m_fast_reconnect = r; }
|
||||
bool fast_reconnect() const { return m_fast_reconnect; }
|
||||
|
||||
// this adds an announcement in the announcement queue
|
||||
// it will let the peer know that we have the given piece
|
||||
void announce_piece(int index);
|
||||
|
@ -732,6 +735,13 @@ namespace libtorrent
|
|||
// the number of bytes send to the disk-io
|
||||
// thread that hasn't yet been completely written.
|
||||
int m_outstanding_writing_bytes;
|
||||
|
||||
// if this is true, the disconnection
|
||||
// timestamp is not updated when the connection
|
||||
// is closed. This means the time until we can
|
||||
// reconnect to this peer is shorter, and likely
|
||||
// immediate.
|
||||
bool m_fast_reconnect;
|
||||
|
||||
#ifndef NDEBUG
|
||||
public:
|
||||
|
|
|
@ -205,6 +205,7 @@ namespace libtorrent
|
|||
// if this fails, we need to reconnect
|
||||
// fast.
|
||||
pi->connected = time_now() - seconds(m_ses.settings().min_reconnect_time);
|
||||
fast_reconnect(true);
|
||||
|
||||
write_pe1_2_dhkey();
|
||||
m_state = read_pe_dhkey;
|
||||
|
@ -380,7 +381,7 @@ namespace libtorrent
|
|||
|
||||
buffer::interval send_buf = allocate_send_buffer(dh_key_len + pad_size);
|
||||
|
||||
std::copy (m_DH_key_exchange->get_local_key(),
|
||||
std::copy(m_DH_key_exchange->get_local_key(),
|
||||
m_DH_key_exchange->get_local_key() + dh_key_len,
|
||||
send_buf.begin);
|
||||
|
||||
|
@ -571,7 +572,7 @@ namespace libtorrent
|
|||
const sha1_hash remote_key = h.final();
|
||||
|
||||
assert(!m_RC4_handler.get());
|
||||
m_RC4_handler.reset (new RC4_handler (local_key, remote_key));
|
||||
m_RC4_handler.reset(new RC4_handler (local_key, remote_key));
|
||||
|
||||
#ifdef TORRENT_VERBOSE_LOGGING
|
||||
(*m_logger) << " computed RC4 keys\n";
|
||||
|
|
|
@ -119,6 +119,7 @@ namespace libtorrent
|
|||
, m_remote_dl_rate(0)
|
||||
, m_remote_dl_update(time_now())
|
||||
, m_outstanding_writing_bytes(0)
|
||||
, m_fast_reconnect(false)
|
||||
#ifndef NDEBUG
|
||||
, m_in_constructor(true)
|
||||
#endif
|
||||
|
@ -195,6 +196,7 @@ namespace libtorrent
|
|||
, m_remote_dl_rate(0)
|
||||
, m_remote_dl_update(time_now())
|
||||
, m_outstanding_writing_bytes(0)
|
||||
, m_fast_reconnect(false)
|
||||
#ifndef NDEBUG
|
||||
, m_in_constructor(true)
|
||||
#endif
|
||||
|
|
|
@ -1340,7 +1340,11 @@ namespace libtorrent
|
|||
p->connection = 0;
|
||||
p->optimistically_unchoked = false;
|
||||
|
||||
p->connected = time_now();
|
||||
// if fast reconnect is true, we won't
|
||||
// update the timestamp, and it will remain
|
||||
// the time when we initiated the connection.
|
||||
if (!c.fast_reconnect())
|
||||
p->connected = time_now();
|
||||
|
||||
if (c.failed())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue