lt sync 2630

This commit is contained in:
Andrew Resch 2008-08-25 16:42:22 +00:00
parent 2b8e235e8a
commit 8899bec6c3
2 changed files with 13 additions and 14 deletions

View File

@ -378,7 +378,7 @@ namespace libtorrent
std::string unknown("Unknown ["); std::string unknown("Unknown [");
for (peer_id::const_iterator i = p.begin(); i != p.end(); ++i) for (peer_id::const_iterator i = p.begin(); i != p.end(); ++i)
{ {
unknown += isprint(*i)?*i:'.'; unknown += isprint(char(*i))?*i:'.';
} }
unknown += "]"; unknown += "]";
return unknown; return unknown;

View File

@ -1581,31 +1581,30 @@ namespace libtorrent
return; return;
} }
for (std::deque<pending_block>::iterator i = m_download_queue.begin(); int block_index = b - m_download_queue.begin();
i != b;) for (int i = 0; i < block_index; ++i)
{ {
pending_block& qe = m_download_queue[i];
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_logger) << time_now_string() (*m_logger) << time_now_string()
<< " *** SKIPPED_PIECE [ piece: " << i->block.piece_index << " | " << " *** SKIPPED_PIECE [ piece: " << eq.block.piece_index << " | "
"b: " << i->block.block_index << " ] ***\n"; "b: " << eq.block.block_index << " ] ***\n";
#endif #endif
++i->skipped; ++qe.skipped;
// if the number of times a block is skipped by out of order // if the number of times a block is skipped by out of order
// blocks exceeds the size of the outstanding queue, assume that // blocks exceeds the size of the outstanding queue, assume that
// the other end dropped the request. // the other end dropped the request.
if (i->skipped > m_desired_queue_size) if (qe.skipped > m_desired_queue_size)
{ {
if (m_ses.m_alerts.should_post<request_dropped_alert>()) if (m_ses.m_alerts.should_post<request_dropped_alert>())
m_ses.m_alerts.post_alert(request_dropped_alert(t->get_handle() m_ses.m_alerts.post_alert(request_dropped_alert(t->get_handle()
, remote(), pid(), i->block.block_index, i->block.piece_index)); , remote(), pid(), qe.block.block_index, qe.block.piece_index));
picker.abort_download(i->block); picker.abort_download(qe.block);
i = m_download_queue.erase(i); m_download_queue.erase(m_download_queue.begin() + i);
} --i;
else --block_index;
{
++i;
} }
} }