1 /***************************************************************************
3 * Copyright (C) 2006 David Brodsky *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation and appearing *
8 * in the file LICENSE.GPL included in the packaging of this file. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13 * General Public License for more details. *
15 ***************************************************************************/
17 #ifndef _main_hashchecker_h
18 #define _main_hashchecker_h
22 #include <tairon/core/signals.h>
34 /** \brief HashChecker is used to check a piece against its hash.
39 /** Constructs a HashChecker object.
41 * \param i Number of the piece to check.
42 * \param s Storage with the piece.
44 HashChecker(uint32_t i
, Storage
*s
);
46 /** Destroys the object.
50 /** Checks the piece's hash. This job is done in a different thread, so
51 * it shouldn't slow down main processing. When the job is done a
52 * specific signal is emitted. This method just creates a functor to
53 * call checkPiece() in a different thread.
55 * \sa hashCorrectSignal
56 * \sa hashIncorrectSignal
60 /** Returns index of the piece that is checked by this object.
67 /** This signal is emitted when the piece has the correct hash.
69 Tairon::Core::DSignal2
<uint32_t, HashChecker
*> hashCorrectSignal
;
71 /** This signal is emitted when the piece has an incorrect hash.
73 Tairon::Core::DSignal2
<uint32_t, HashChecker
*> hashIncorrectSignal
;
81 /** Disabler for functor that calls checkPiece() method.
83 Tairon::Core::FunctorDisabler
*disabler
;
85 /** Index of the piece.
89 /** Informations about the piece.
93 /** Hash of the piece from the torrent's metainfo.
100 }; // namespace Tairent
104 // vim: ai sw=4 ts=4 noet fdm=marker