aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2012-12-04 23:53:26 +0100
committerPieter Wuille <[email protected]>2012-12-06 22:04:59 +0100
commit3fb9b99cca390e8ac5838c03363c46a99396e463 (patch)
tree5d792804a3a46b72f35e6490cd8247f81395ff76 /src/main.cpp
parentUpdate the block file counter in database when using -reindex (diff)
downloaddiscoin-3fb9b99cca390e8ac5838c03363c46a99396e463.tar.xz
discoin-3fb9b99cca390e8ac5838c03363c46a99396e463.zip
Allow lengthy block reconnections to be interrupted
When the coin database is out of date with the block database, the best block in it is automatically switched to. This reconnection process can take time, so allow it to be interrupted. This also stops block connection as soon as shutdown is requested, leading to a faster shutdown.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0e0be2f01..158c94783 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1240,9 +1240,12 @@ bool ConnectBestBlock() {
if (pindexTest->pprev == NULL || pindexTest->pnext != NULL) {
reverse(vAttach.begin(), vAttach.end());
- BOOST_FOREACH(CBlockIndex *pindexSwitch, vAttach)
+ BOOST_FOREACH(CBlockIndex *pindexSwitch, vAttach) {
+ if (fRequestShutdown)
+ break;
if (!SetBestChain(pindexSwitch))
return false;
+ }
return true;
}
pindexTest = pindexTest->pprev;
@@ -2553,7 +2556,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
}
}
uint64 nRewind = blkdat.GetPos();
- while (blkdat.good() && !blkdat.eof() && !fShutdown) {
+ while (blkdat.good() && !blkdat.eof() && !fRequestShutdown) {
blkdat.SetPos(nRewind);
nRewind++; // start one byte further next time, in case of failure
blkdat.SetLimit(); // remove former limit