You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When backsource file with unknown content length, the remote peer will hang if the local peer didn't sync content length and total pieces with remote peer before sending the last piece.
Suppose file size=128MB, pieceSize=4MB, totalPieces=32. the local peer will send 32 pieces to remote peer, and total pieces=-1 in the last piece.
This is due to the last piece(31) is sent before the content length is generated, and the remote peer will wait infinitiy since it didn't get the content length info.
Bug report:
When backsource file with unknown content length, the remote peer will hang if the local peer didn't sync content length and total pieces with remote peer before sending the last piece.
Suppose file size=128MB, pieceSize=4MB, totalPieces=32. the local peer will send 32 pieces to remote peer, and total pieces=-1 in the last piece.
This is due to the last piece(31) is sent before the content length is generated, and the remote peer will wait infinitiy since it didn't get the content length info.
Root cause in code:
The last piece(32) size can be zero when file size aligns with piece size, so it didn't count into total pieces which is fine.
Dragonfly2/client/daemon/peer/piece_manager.go
Lines 556 to 563 in 75d6242
But when content length is updated, the real last piece(31) can already be sent, causing content length info missed.
Dragonfly2/client/daemon/peer/piece_manager.go
Lines 597 to 602 in 75d6242
Expected behavior:
How to reproduce it:
Add a time.Sleep before updating content length, and download a 128MB file.
Dragonfly2/client/daemon/peer/piece_manager.go
Lines 597 to 602 in 75d6242
Environment:
uname -a
):The text was updated successfully, but these errors were encountered: