← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3206: Cancel the v2->v3 hash upgrade if it takes longer than 26sec

 

------------------------------------------------------------
revno: 3206
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2013-02-12 23:22:05 +0100
message:
  Cancel the v2->v3 hash upgrade if it takes longer than 26sec
modified:
  changelog.txt
  dcpp/HashManager.cpp


--
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 'changelog.txt'
--- changelog.txt	2013-02-12 19:16:15 +0000
+++ changelog.txt	2013-02-12 22:22:05 +0000
@@ -1,6 +1,7 @@
 * Fix status bar parts when the window is too small (poy)
 * [L#534440] [NMDC] Preserve encodings in some search results (poy)
 * [ADC] Fix problems after marking oneself as a favorite user
+* Cancel the v2->v3 hash upgrade if it takes longer than 26sec (poy)
 
 -- 0.810 2013-01-30 --
 * Fix a race condition on file list download (thanks bigmuscle)

=== modified file 'dcpp/HashManager.cpp'
--- dcpp/HashManager.cpp	2013-01-18 21:28:38 +0000
+++ dcpp/HashManager.cpp	2013-02-12 22:22:05 +0000
@@ -383,6 +383,14 @@
 		return false;
 	}
 
+	static auto upgradeStart = GET_TICK();
+	static auto cancelled = false;
+	if(cancelled || GET_TICK() > upgradeStart + 26 * 1000) {
+		// the upgrade is taking too long - cancel the process; the files will be re-hashed.
+		cancelled = true;
+		return false;
+	}
+
 	WIN32_FIND_DATA data;
 	// FindFirstFile does a case-insensitive search by default
 	auto handle = ::FindFirstFile(Text::toT(file).c_str(), &data);