merged fix from RC_0_16

This commit is contained in:
Arvid Norberg 2013-09-12 07:10:52 +00:00
parent d42ca11ef3
commit f2e16c36b3
2 changed files with 11 additions and 5 deletions

View File

@ -24,6 +24,7 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* improve error message for 'file too short'
* fix piece-picker stat bug when only selecting some files for download
* fix bug in async_add_torrent when settings file_priorities
* fix boost-1.42 support for python bindings

View File

@ -824,8 +824,9 @@ namespace libtorrent
if (ret != buffer_size)
{
// this means the file wasn't big enough for this read
p.storage->get_storage_impl()->set_error(""
, errors::file_too_short);
char msg[70];
snprintf(msg, sizeof(msg), "reading p: %d b: %d s: %d (read: %d)", p.piece, start_block, buffer_size, ret);
p.storage->get_storage_impl()->set_error(msg, errors::file_too_short);
free_piece(p, l);
return -1;
}
@ -855,8 +856,9 @@ namespace libtorrent
if (ret != buffer_size)
{
// this means the file wasn't big enough for this read
p.storage->get_storage_impl()->set_error(""
, errors::file_too_short);
char msg[70];
snprintf(msg, sizeof(msg), "reading p: %d b: %d s: %d (read: %d)", p.piece, start_block, buffer_size, ret);
p.storage->get_storage_impl()->set_error(msg, errors::file_too_short);
free_piece(p, l);
return -1;
}
@ -2032,10 +2034,13 @@ namespace libtorrent
}
if (ret != j.buffer_size)
{
char msg[70];
snprintf(msg, sizeof(msg), "reading p: %d o: %d s: %d (read: %d)", j.piece, j.offset, j.buffer_size, ret);
// this means the file wasn't big enough for this read
j.buffer = 0;
j.error = errors::file_too_short;
j.error_file.clear();
j.error_file = msg;
j.str.clear();
ret = -1;
break;