|
|
@ -1385,47 +1385,6 @@ bool static ProcessBlock(CNode* pfrom, CBlock* pblock) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename Stream> |
|
|
|
|
|
|
|
bool static ScanMessageStart(Stream& s) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Scan ahead to the next pchMessageStart, which should normally be immediately
|
|
|
|
|
|
|
|
// at the file pointer. Leaves file pointer at end of pchMessageStart.
|
|
|
|
|
|
|
|
s.clear(0); |
|
|
|
|
|
|
|
short prevmask = s.exceptions(0); |
|
|
|
|
|
|
|
const char* p = BEGIN(pchMessageStart); |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
loop |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
char c; |
|
|
|
|
|
|
|
s.read(&c, 1); |
|
|
|
|
|
|
|
if (s.fail()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
s.clear(0); |
|
|
|
|
|
|
|
s.exceptions(prevmask); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (*p != c) |
|
|
|
|
|
|
|
p = BEGIN(pchMessageStart); |
|
|
|
|
|
|
|
if (*p == c) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (++p == END(pchMessageStart)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
s.clear(0); |
|
|
|
|
|
|
|
s.exceptions(prevmask); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (...) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
s.clear(0); |
|
|
|
|
|
|
|
s.exceptions(prevmask); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CheckDiskSpace(uint64 nAdditionalBytes) |
|
|
|
bool CheckDiskSpace(uint64 nAdditionalBytes) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available; |
|
|
|
uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available; |
|
|
|