merged read_piece response for cancelled time-critical pieces, from RC_0_16

This commit is contained in:
Arvid Norberg 2013-01-28 07:27:44 +00:00
parent 42ee2869b1
commit ff81a258af
2 changed files with 18 additions and 0 deletions

View File

@ -11,6 +11,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
* fix read-piece response for cancelled deadline-pieces
* fixed file priority vector-overrun * fixed file priority vector-overrun
* fix potential packet allocation alignment issue in utp * fix potential packet allocation alignment issue in utp
* make 'close_redudnant_connections' cover more cases * make 'close_redudnant_connections' cover more cases

View File

@ -939,6 +939,11 @@ namespace libtorrent
if (m_abort) if (m_abort)
{ {
// failed // failed
// TODO: 3 add an error code to the read_piece alert
// to indicate what went wrong. operation_aborted in this
// case. It also has to be included in the cases where
// a time_critical_piece is aborted by setting its priority
// to zero.
m_ses.m_alerts.post_alert(read_piece_alert( m_ses.m_alerts.post_alert(read_piece_alert(
get_handle(), piece, boost::shared_array<char>(), 0)); get_handle(), piece, boost::shared_array<char>(), 0));
return; return;
@ -3808,6 +3813,12 @@ namespace libtorrent
} }
} }
} }
else if (i->flags & torrent_handle::alert_when_available)
{
// post an empty read_piece_alert to indicate it failed
m_ses.m_alerts.post_alert(read_piece_alert(
get_handle(), piece, boost::shared_array<char>(), 0));
}
m_time_critical_pieces.erase(i); m_time_critical_pieces.erase(i);
return; return;
} }
@ -3821,6 +3832,12 @@ namespace libtorrent
{ {
if (priority[i->piece] == 0) if (priority[i->piece] == 0)
{ {
if (i->flags & torrent_handle::alert_when_available)
{
// post an empty read_piece_alert to indicate it failed
m_ses.m_alerts.post_alert(read_piece_alert(
get_handle(), i->piece, boost::shared_array<char>(), 0));
}
i = m_time_critical_pieces.erase(i); i = m_time_critical_pieces.erase(i);
continue; continue;
} }