completed fast reconnect fix
This commit is contained in:
@@ -176,6 +176,9 @@ namespace libtorrent
|
|||||||
void set_non_prioritized(bool b)
|
void set_non_prioritized(bool b)
|
||||||
{ m_non_prioritized = 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
|
// this adds an announcement in the announcement queue
|
||||||
// it will let the peer know that we have the given piece
|
// it will let the peer know that we have the given piece
|
||||||
void announce_piece(int index);
|
void announce_piece(int index);
|
||||||
@@ -733,6 +736,13 @@ namespace libtorrent
|
|||||||
// thread that hasn't yet been completely written.
|
// thread that hasn't yet been completely written.
|
||||||
int m_outstanding_writing_bytes;
|
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
|
#ifndef NDEBUG
|
||||||
public:
|
public:
|
||||||
bool m_in_constructor;
|
bool m_in_constructor;
|
||||||
|
@@ -205,6 +205,7 @@ namespace libtorrent
|
|||||||
// if this fails, we need to reconnect
|
// if this fails, we need to reconnect
|
||||||
// fast.
|
// fast.
|
||||||
pi->connected = time_now() - seconds(m_ses.settings().min_reconnect_time);
|
pi->connected = time_now() - seconds(m_ses.settings().min_reconnect_time);
|
||||||
|
fast_reconnect(true);
|
||||||
|
|
||||||
write_pe1_2_dhkey();
|
write_pe1_2_dhkey();
|
||||||
m_state = read_pe_dhkey;
|
m_state = read_pe_dhkey;
|
||||||
|
@@ -119,6 +119,7 @@ namespace libtorrent
|
|||||||
, m_remote_dl_rate(0)
|
, m_remote_dl_rate(0)
|
||||||
, m_remote_dl_update(time_now())
|
, m_remote_dl_update(time_now())
|
||||||
, m_outstanding_writing_bytes(0)
|
, m_outstanding_writing_bytes(0)
|
||||||
|
, m_fast_reconnect(false)
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
, m_in_constructor(true)
|
, m_in_constructor(true)
|
||||||
#endif
|
#endif
|
||||||
@@ -195,6 +196,7 @@ namespace libtorrent
|
|||||||
, m_remote_dl_rate(0)
|
, m_remote_dl_rate(0)
|
||||||
, m_remote_dl_update(time_now())
|
, m_remote_dl_update(time_now())
|
||||||
, m_outstanding_writing_bytes(0)
|
, m_outstanding_writing_bytes(0)
|
||||||
|
, m_fast_reconnect(false)
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
, m_in_constructor(true)
|
, m_in_constructor(true)
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1340,6 +1340,10 @@ namespace libtorrent
|
|||||||
p->connection = 0;
|
p->connection = 0;
|
||||||
p->optimistically_unchoked = false;
|
p->optimistically_unchoked = false;
|
||||||
|
|
||||||
|
// 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();
|
p->connected = time_now();
|
||||||
|
|
||||||
if (c.failed())
|
if (c.failed())
|
||||||
|
Reference in New Issue
Block a user