File indexing completed on 2025-01-05 04:37:09

0001 /*
0002     SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #include "datacheckerthread.h"
0007 #include "datachecker.h"
0008 #include <torrent/torrent.h>
0009 #include <util/error.h>
0010 #include <util/log.h>
0011 
0012 namespace bt
0013 {
0014 DataCheckerThread::DataCheckerThread(DataChecker *dc, const BitSet &status, const QString &path, const Torrent &tor, const QString &dnddir)
0015     : dc(dc)
0016     , path(path)
0017     , tor(tor)
0018     , dnddir(dnddir)
0019     , status(status)
0020 {
0021     running = true;
0022     dc->moveToThread(this);
0023 }
0024 
0025 DataCheckerThread::~DataCheckerThread()
0026 {
0027     delete dc;
0028 }
0029 
0030 void DataCheckerThread::run()
0031 {
0032     try {
0033         dc->check(path, tor, dnddir, status);
0034     } catch (bt::Error &e) {
0035         error = e.toString();
0036         Out(SYS_GEN | LOG_DEBUG) << error << endl;
0037     }
0038     running = false;
0039 }
0040 
0041 }