diff --git a/ChangeLog b/ChangeLog index 218ffabe1..b19102530 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * fix read-piece response for cancelled deadline-pieces * fixed file priority vector-overrun * fix potential packet allocation alignment issue in utp * make 'close_redudnant_connections' cover more cases diff --git a/src/torrent.cpp b/src/torrent.cpp index a3ec1eb6a..f09d1a6cb 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -939,6 +939,11 @@ namespace libtorrent if (m_abort) { // 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( get_handle(), piece, boost::shared_array(), 0)); 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(), 0)); + } m_time_critical_pieces.erase(i); return; } @@ -3821,6 +3832,12 @@ namespace libtorrent { 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(), 0)); + } i = m_time_critical_pieces.erase(i); continue; }