when do piece hash checks happen

General support for problems installing or using Deluge
Post Reply
danoctavian
New User
New User
Posts: 2
Joined: Sat May 31, 2014 2:01 pm

when do piece hash checks happen

Post by danoctavian »

When does Deluge check the hash of a piece for correctness?

I'm currently tampering with the pieces sent by a seeder and messing up their payload (without changing the message format though). As soon as I do that the peer receiving pieces from the seeder closes the connection.

Does this mean Deluge check pieces on the spot? If so, can i disable this behavior?

Thanks!
danoctavian
New User
New User
Posts: 2
Joined: Sat May 31, 2014 2:01 pm

Re: when do piece hash checks happen

Post by danoctavian »

Answer to my own question:

Yes. the piece is asynchronously checked after it is written to disk.

Based on the libtorrent source code:

the method peer_connection::incoming_piece writes the piece to disk and requests that the method on_disk_write_complete is called once the write is done. This latter method calls at the very end verify_piece.
// this is in the peer_connection.cpp
line 2112 t->async_verify_piece(p.piece, bind(&torrent::piece_finished, t, p.piece, _1));

So asynchronous piece checks are issued as soon as pieces are received.

To the question: can this behavior be changed (with a setting)?
The answer is no. There is no flag to disable this atm. I guess you can always fork your own libtorrent and go from there.
Post Reply