Download a piece #nd2

test is timing out after 10 seconds.

Is this test supposed to finish in 10 seconds ? file is kind of large and there is network latency involved. Also, I am downloading each piece sequentially. Maybe that makes it slow.

maybe increate the timeout for nd2 as well ?

Here is the link to my repo. maybe I am missing something in the implementation.

Hi Rahul,
10 seconds should be enough to download one piece. Pieces are around 256 kb, they’re not that large. I’ve seen sequential implementations pass this stage. Not sure why yours doesn’t, consider requesting multiple parts of the piece in parallel from one peer.

2 Likes

This is a non-blocking implementation where I send all the request to a single host through the same socket. For some reason, It passes the first test, but fails the second test.

  • May I need to do some cleanup after finishing the first session ( I am doing socket.close())
  • maybe peer have some rate limiting thing going on. so need to pace it.

Does anyone have any insight what might be happening here ?

Thanks in advance.

Hi Rahul,
Second test is requesting the last piece of the file and it looks like you’re requesting more than what is available in the file.

Last piece of the file can be less than piece length defined in the torrent file. For example, say file length is 92063 bytes and piece length is 32768 bytes. This file will consist of 3 pieces:

  • 1st piece with 32768 bytes
  • 2nd piece with 32768 bytes
  • 3rd piece with only 26527 bytes.

Is this the case with your implementation?

Understood. I missed this part totally.

Thanks.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.