report errors in read_piece_alert

This commit is contained in:
Arvid Norberg
2013-01-29 02:18:32 +00:00
parent ac5743cfbe
commit 2aacf1cd66
6 changed files with 39 additions and 16 deletions

View File

@@ -6314,6 +6314,10 @@ e.g::
case read_piece_alert::alert_type:
{
read_piece_alert* p = (read_piece_alert*)a.get();
if (p->ec) {
// read_piece failed
break;
}
// use p
break;
}
@@ -6432,11 +6436,14 @@ is 0. If successful, ``buffer`` points to a buffer containing all the data
of the piece. ``piece`` is the piece index that was read. ``size`` is the
number of bytes that was read.
If the operation fails, ec will indicat what went wrong.
::
struct read_piece_alert: torrent_alert
{
// ...
error_code ec;
boost::shared_ptr<char> buffer;
int piece;
int size;