← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2863: Fix %[sfv] param for finished downloads log

 

------------------------------------------------------------
revno: 2863
committer: eMTee <emtee11@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Sat 2012-02-11 11:48:20 +0100
message:
  Fix %[sfv] param for finished downloads log
modified:
  dcpp/QueueManager.cpp
  dcpp/QueueManager.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/QueueManager.cpp'
--- dcpp/QueueManager.cpp	2012-02-04 18:32:29 +0000
+++ dcpp/QueueManager.cpp	2012-02-11 10:48:20 +0000
@@ -1061,8 +1061,9 @@
 			} else if(d->getType() == Transfer::TYPE_FILE) {
 				q->addSegment(d->getSegment());
 
-				auto crcError = q->isFinished() && BOOLSETTING(SFV_CHECK) && checkSfv(q, d.get());
+				auto crcChecked = q->isFinished() && BOOLSETTING(SFV_CHECK) && checkSfv(q, d.get());
 
+				// In case of a failed crc check segments are reset
 				if(q->isFinished()) {
 					// Check if we need to move the file
 					if(!d->getTempTarget().empty() && (Util::stricmp(d->getPath().c_str(), d->getTempTarget().c_str()) != 0) ) {
@@ -1070,7 +1071,7 @@
 					}
 
 					if (BOOLSETTING(LOG_FINISHED_DOWNLOADS)) {
-						logFinishedDownload(q, d.get(), crcError);
+						logFinishedDownload(q, d.get(), crcChecked);
 					}
 
 					userQueue.remove(q);
@@ -1620,11 +1621,11 @@
 			}
 
 			fire(QueueManagerListener::CRCFailed(), d, _("CRC32 inconsistency (SFV-Check)"));
-			return true;
+		} else {
+			dcdebug("QueueManager: CRC32 match for %s\n", qi->getTarget().c_str());
+			fire(QueueManagerListener::CRCChecked(), d);
 		}
-
-		dcdebug("QueueManager: CRC32 match for %s\n", qi->getTarget().c_str());
-		fire(QueueManagerListener::CRCChecked(), d);
+		return true;
 	}
 	return false;
 }
@@ -1637,14 +1638,14 @@
 	return crc32.getValue();
 }
 
-void QueueManager::logFinishedDownload(QueueItem* qi, Download* d, bool crcError)
+void QueueManager::logFinishedDownload(QueueItem* qi, Download* d, bool crcChecked)
 {
 	ParamMap params;
 	params["target"] = qi->getTarget();
 	params["fileSI"] = Util::toString(qi->getSize());
 	params["fileSIshort"] = Util::formatBytes(qi->getSize());
 	params["fileTR"] = qi->getTTH().toBase32();
-	params["sfv"] = Util::toString(crcError ? 1 : 0);
+	params["sfv"] = Util::toString(crcChecked ? 1 : 0);
 
 	FinishedManager::getInstance()->getParams(qi->getTarget(), params);
 

=== modified file 'dcpp/QueueManager.h'
--- dcpp/QueueManager.h	2012-01-13 20:55:20 +0000
+++ dcpp/QueueManager.h	2012-02-11 10:48:20 +0000
@@ -272,7 +272,7 @@
 	bool checkSfv(QueueItem* qi, Download* d);
 	uint32_t calcCrc32(const string& file);
 
-	void logFinishedDownload(QueueItem* qi, Download* d, bool crcError);
+	void logFinishedDownload(QueueItem* qi, Download* d, bool crcChecked);
 
 	// TimerManagerListener
 	virtual void on(TimerManagerListener::Second, uint64_t aTick) noexcept;