y500 / libtorrent

Automatically exported from code.google.com/p/libtorrent
0 stars 0 forks source link

wrong file progress in trunk #691

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
libtorrent reports wrong file progress.
This seems to happen with multi file torrents there a few small and one large 
file share the same piece and we don't have this piece (small files at the 
begin of the piece).

I think torrent::file_progress() (piece_granularity) does not handle this case 
right.

btw,
doesn't this condition skip the test if we have the piece or not?
...
if (file_offset >= fs.file_size(file_index))
{  ++file_index;
   continue;      <-------
}
...

I don't know if the problem happens in the initial calculation or later.

Original issue reported on code.google.com by webmas...@massaroddel.de on 2 Nov 2014 at 6:03

GoogleCodeExporter commented 8 years ago
looking at that code, it's not clear to my why I had to add that condition at 
all. the only thing I can think of are 0-sized files.

does it work if you remove that whole if-block?

Original comment by arvid.no...@gmail.com on 6 Nov 2014 at 1:18

GoogleCodeExporter commented 8 years ago
If I remove the if-block I get the following assert. Without the assert I get 
negative progress values for some files because of:

...
int add = (std::min)(boost::int64_t(size), fs.file_size(file_index) - 
file_offset);
...

file_offset is bigger than file_size

Original comment by webmas...@massaroddel.de on 6 Nov 2014 at 4:48

GoogleCodeExporter commented 8 years ago
fixed in trunk [10473]. thanks for the report!

Original comment by arvid.no...@gmail.com on 8 Nov 2014 at 6:37

GoogleCodeExporter commented 8 years ago
Its not working for me. I get different asserts. Also for a new torrent the 
file progress vector is returned with size 0.

Original comment by webmas...@massaroddel.de on 10 Nov 2014 at 4:44

GoogleCodeExporter commented 8 years ago
ok. I actually just ran into an assert there too. I'll be taking a closer look 
tonight.

Original comment by arvid.no...@gmail.com on 10 Nov 2014 at 5:21

GoogleCodeExporter commented 8 years ago
fixed in [10480].

Original comment by arvid.no...@gmail.com on 14 Nov 2014 at 7:45