lowered piece timeout and sends cancels for pieces when a time out occurs
This commit is contained in:
@@ -87,7 +87,7 @@ namespace libtorrent
|
|||||||
, tracker_receive_timeout(20)
|
, tracker_receive_timeout(20)
|
||||||
, stop_tracker_timeout(5)
|
, stop_tracker_timeout(5)
|
||||||
, tracker_maximum_response_length(1024*1024)
|
, tracker_maximum_response_length(1024*1024)
|
||||||
, piece_timeout(120)
|
, piece_timeout(10)
|
||||||
, request_queue_time(3.f)
|
, request_queue_time(3.f)
|
||||||
, max_allowed_in_request_queue(250)
|
, max_allowed_in_request_queue(250)
|
||||||
, max_out_request_queue(200)
|
, max_out_request_queue(200)
|
||||||
|
@@ -424,6 +424,7 @@ namespace libtorrent
|
|||||||
}
|
}
|
||||||
|
|
||||||
int block_size() const { TORRENT_ASSERT(m_block_size > 0); return m_block_size; }
|
int block_size() const { TORRENT_ASSERT(m_block_size > 0); return m_block_size; }
|
||||||
|
peer_request to_req(piece_block const& p);
|
||||||
|
|
||||||
// this will tell all peers that we just got his piece
|
// this will tell all peers that we just got his piece
|
||||||
// and also let the piece picker know that we have this piece
|
// and also let the piece picker know that we have this piece
|
||||||
|
@@ -2209,18 +2209,19 @@ namespace libtorrent
|
|||||||
piece_picker& picker = t->picker();
|
piece_picker& picker = t->picker();
|
||||||
while (!m_download_queue.empty())
|
while (!m_download_queue.empty())
|
||||||
{
|
{
|
||||||
picker.abort_download(m_download_queue.back());
|
piece_block const& r = m_download_queue.back();
|
||||||
|
picker.abort_download(r);
|
||||||
|
write_cancel(t->to_req(r));
|
||||||
m_download_queue.pop_back();
|
m_download_queue.pop_back();
|
||||||
}
|
}
|
||||||
while (!m_request_queue.empty())
|
while (!m_request_queue.empty())
|
||||||
{
|
{
|
||||||
picker.abort_download(m_request_queue.back());
|
piece_block const& r = m_request_queue.back();
|
||||||
|
picker.abort_download(r);
|
||||||
|
write_cancel(t->to_req(r));
|
||||||
m_request_queue.pop_back();
|
m_request_queue.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: If we have a limited number of upload
|
|
||||||
// slots, choke this peer
|
|
||||||
|
|
||||||
m_assume_fifo = true;
|
m_assume_fifo = true;
|
||||||
|
|
||||||
request_a_block(*t, *this);
|
request_a_block(*t, *this);
|
||||||
|
@@ -326,6 +326,21 @@ namespace libtorrent
|
|||||||
disconnect_all();
|
disconnect_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
peer_request torrent::to_req(piece_block const& p)
|
||||||
|
{
|
||||||
|
int block_offset = p.block_index * m_block_size;
|
||||||
|
int block_size = (std::min)((int)torrent_file().piece_size(
|
||||||
|
p.piece_index) - block_offset, m_block_size);
|
||||||
|
TORRENT_ASSERT(block_size > 0);
|
||||||
|
TORRENT_ASSERT(block_size <= m_block_size);
|
||||||
|
|
||||||
|
peer_request r;
|
||||||
|
r.piece = p.piece_index;
|
||||||
|
r.start = block_offset;
|
||||||
|
r.length = block_size;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
std::string torrent::name() const
|
std::string torrent::name() const
|
||||||
{
|
{
|
||||||
if (valid_metadata()) return m_torrent_file->name();
|
if (valid_metadata()) return m_torrent_file->name();
|
||||||
|
Reference in New Issue
Block a user