Browse Source

Merge pull request #2074 from sipa/minor

Two minor inconvenience fixes
0.8
Gavin Andresen 12 years ago
parent
commit
8b83e2fc2e
  1. 8
      src/init.cpp
  2. 8
      src/main.cpp
  3. 2
      src/util.cpp
  4. 2
      src/util.h

8
src/init.cpp

@ -345,7 +345,7 @@ void ThreadImport(void *data) {
if (fReindex) { if (fReindex) {
CImportingNow imp; CImportingNow imp;
int nFile = 0; int nFile = 0;
while (!fShutdown) { while (!fRequestShutdown) {
CDiskBlockPos pos(nFile, 0); CDiskBlockPos pos(nFile, 0);
FILE *file = OpenBlockFile(pos, true); FILE *file = OpenBlockFile(pos, true);
if (!file) if (!file)
@ -354,7 +354,7 @@ void ThreadImport(void *data) {
LoadExternalBlockFile(file, &pos); LoadExternalBlockFile(file, &pos);
nFile++; nFile++;
} }
if (!fShutdown) { if (!fRequestShutdown) {
pblocktree->WriteReindexing(false); pblocktree->WriteReindexing(false);
fReindex = false; fReindex = false;
printf("Reindexing finished\n"); printf("Reindexing finished\n");
@ -363,7 +363,7 @@ void ThreadImport(void *data) {
// hardcoded $DATADIR/bootstrap.dat // hardcoded $DATADIR/bootstrap.dat
filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat"; filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
if (filesystem::exists(pathBootstrap) && !fShutdown) { if (filesystem::exists(pathBootstrap) && !fRequestShutdown) {
FILE *file = fopen(pathBootstrap.string().c_str(), "rb"); FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
if (file) { if (file) {
CImportingNow imp; CImportingNow imp;
@ -376,7 +376,7 @@ void ThreadImport(void *data) {
// -loadblock= // -loadblock=
BOOST_FOREACH(boost::filesystem::path &path, import->vFiles) { BOOST_FOREACH(boost::filesystem::path &path, import->vFiles) {
if (fShutdown) if (fRequestShutdown)
break; break;
FILE *file = fopen(path.string().c_str(), "rb"); FILE *file = fopen(path.string().c_str(), "rb");
if (file) { if (file) {

8
src/main.cpp

@ -1240,9 +1240,12 @@ bool ConnectBestBlock() {
if (pindexTest->pprev == NULL || pindexTest->pnext != NULL) { if (pindexTest->pprev == NULL || pindexTest->pnext != NULL) {
reverse(vAttach.begin(), vAttach.end()); reverse(vAttach.begin(), vAttach.end());
BOOST_FOREACH(CBlockIndex *pindexSwitch, vAttach) BOOST_FOREACH(CBlockIndex *pindexSwitch, vAttach) {
if (fRequestShutdown)
break;
if (!SetBestChain(pindexSwitch)) if (!SetBestChain(pindexSwitch))
return false; return false;
}
return true; return true;
} }
pindexTest = pindexTest->pprev; pindexTest = pindexTest->pprev;
@ -1897,6 +1900,7 @@ bool FindBlockPos(CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeigh
nLastBlockFile = pos.nFile; nLastBlockFile = pos.nFile;
infoLastBlockFile.SetNull(); infoLastBlockFile.SetNull();
pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile); pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile);
fUpdatedLast = true;
} }
} else { } else {
while (infoLastBlockFile.nSize + nAddSize >= MAX_BLOCKFILE_SIZE) { while (infoLastBlockFile.nSize + nAddSize >= MAX_BLOCKFILE_SIZE) {
@ -2556,7 +2560,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
} }
} }
uint64 nRewind = blkdat.GetPos(); uint64 nRewind = blkdat.GetPos();
while (blkdat.good() && !blkdat.eof() && !fShutdown) { while (blkdat.good() && !blkdat.eof() && !fRequestShutdown) {
blkdat.SetPos(nRewind); blkdat.SetPos(nRewind);
nRewind++; // start one byte further next time, in case of failure nRewind++; // start one byte further next time, in case of failure
blkdat.SetLimit(); // remove former limit blkdat.SetLimit(); // remove former limit

2
src/util.cpp

@ -64,7 +64,7 @@ bool fDebug = false;
bool fDebugNet = false; bool fDebugNet = false;
bool fPrintToConsole = false; bool fPrintToConsole = false;
bool fPrintToDebugger = false; bool fPrintToDebugger = false;
bool fRequestShutdown = false; volatile bool fRequestShutdown = false;
bool fShutdown = false; bool fShutdown = false;
bool fDaemon = false; bool fDaemon = false;
bool fServer = false; bool fServer = false;

2
src/util.h

@ -132,7 +132,7 @@ extern bool fDebug;
extern bool fDebugNet; extern bool fDebugNet;
extern bool fPrintToConsole; extern bool fPrintToConsole;
extern bool fPrintToDebugger; extern bool fPrintToDebugger;
extern bool fRequestShutdown; extern volatile bool fRequestShutdown;
extern bool fShutdown; extern bool fShutdown;
extern bool fDaemon; extern bool fDaemon;
extern bool fServer; extern bool fServer;

Loading…
Cancel
Save