sa3paleasm / libtorrent

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

block timeout did not apply in mean time #313

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm working on a project that use libtorrent as base for streaming video via 
peer2peer network, so most time I need libtorrent to download in sequential 
mode. I prefer using set_piece_deadline to set_sequential to achieve data in 
sequence. 

My problem is some pieces are very slow to finish, I do print block state info 
on that piece and see that there's one block in requested state so long time 
(sometimes is few minutes, sometimes never done that block). I was set 
request_timeout on libtorrent session to '10' and expect that a block should be 
finished in 10 second, otherwise choose other peer and re-request the block.
Follow is a piece of code I use to print block state:

libtorrent::block_info &bi = p->blocks[cc];
std::stringstream wait_block_info;
int cc = block_index;
if (bi.state!=libtorrent::block_info::finished){
    std::string const& adr_ = bi.peer().address().to_string();
    wait_block_info << "[stat="  << bi.state << ", bidx=" << cc << ", bytes=" << bi.bytes_progress << "/" << bi.block_size << ", npeer=" << bi.num_peers << ",peer=" << adr_ << "]<br />";
}

So, What is the expected output? the address of peer that use to download the 
block should change after request_timeout seconds.

What do you see instead? block is never finish and the peer used to download 
the block is not change.

secmask.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by secm...@gmail.com on 22 Apr 2012 at 4:18

GoogleCodeExporter commented 8 years ago
Sorry, I use Windows 7 and libtorrent 0.15.10.

Original comment by secm...@gmail.com on 22 Apr 2012 at 4:19

GoogleCodeExporter commented 8 years ago
This issue is discussed in a blog post of mine: 
http://www.rasterbar.com/libtorrent_blog/2011/11/block-request-time-outs

using sequential download is not a very good approximation of in-ordered 
downloads. I would suggest using set_piece_deadline() instead.

Original comment by arvid.no...@gmail.com on 6 May 2012 at 12:53

GoogleCodeExporter commented 8 years ago
Yes, I mean that trouble I met when use set_piece_deadline.

Original comment by secm...@gmail.com on 6 May 2012 at 1:14