forked from premiere/premiere-libtorrent
merged close_redundant_connections fix from RC_0_16
This commit is contained in:
parent
a35c32bc51
commit
bca1d62bbe
|
@ -10,6 +10,7 @@
|
||||||
* fix uTP edge case where udp socket buffer fills up
|
* fix uTP edge case where udp socket buffer fills up
|
||||||
* fix nagle implementation in uTP
|
* fix nagle implementation in uTP
|
||||||
|
|
||||||
|
* make 'close_redudnant_connections' cover more cases
|
||||||
* set_piece_deadline() also unfilters the piece (if its priority is 0)
|
* set_piece_deadline() also unfilters the piece (if its priority is 0)
|
||||||
* add work-around for bug in windows vista and earlier in GetOverlappedResult
|
* add work-around for bug in windows vista and earlier in GetOverlappedResult
|
||||||
* fix traversal algorithm leak in DHT
|
* fix traversal algorithm leak in DHT
|
||||||
|
|
|
@ -1853,6 +1853,11 @@ namespace libtorrent
|
||||||
if (m_upload_only_id == 0) return;
|
if (m_upload_only_id == 0) return;
|
||||||
if (t->share_mode()) return;
|
if (t->share_mode()) return;
|
||||||
|
|
||||||
|
// if we send upload-only, the other end is very likely to disconnect
|
||||||
|
// us, at least if it's a seed. If we don't want to close redundant
|
||||||
|
// connections, don't sent upload-only
|
||||||
|
if (!m_ses.settings().close_redundant_connections) return;
|
||||||
|
|
||||||
char msg[7] = {0, 0, 0, 3, msg_extended};
|
char msg[7] = {0, 0, 0, 3, msg_extended};
|
||||||
char* ptr = msg + 5;
|
char* ptr = msg + 5;
|
||||||
detail::write_uint8(m_upload_only_id, ptr);
|
detail::write_uint8(m_upload_only_id, ptr);
|
||||||
|
|
|
@ -6183,7 +6183,10 @@ namespace libtorrent
|
||||||
m_completed_time = time(0);
|
m_completed_time = time(0);
|
||||||
|
|
||||||
// disconnect all seeds
|
// disconnect all seeds
|
||||||
|
if (settings().close_redundant_connections)
|
||||||
|
{
|
||||||
// TODO: 1 should disconnect all peers that have the pieces we have
|
// TODO: 1 should disconnect all peers that have the pieces we have
|
||||||
|
// not just seeds
|
||||||
// not just seeds. It would be pretty expensive to check all pieces
|
// not just seeds. It would be pretty expensive to check all pieces
|
||||||
// for all peers though
|
// for all peers though
|
||||||
std::vector<peer_connection*> seeds;
|
std::vector<peer_connection*> seeds;
|
||||||
|
@ -6202,6 +6205,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
std::for_each(seeds.begin(), seeds.end()
|
std::for_each(seeds.begin(), seeds.end()
|
||||||
, boost::bind(&peer_connection::disconnect, _1, errors::torrent_finished, 0));
|
, boost::bind(&peer_connection::disconnect, _1, errors::torrent_finished, 0));
|
||||||
|
}
|
||||||
|
|
||||||
if (m_abort) return;
|
if (m_abort) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue