Do not rewrite dumpfile before blocking

This commit is contained in:
Pieter Wuille 2013-02-24 20:54:53 +01:00
parent d25302b565
commit 2f65b2adaa

View file

@ -270,6 +270,8 @@ extern "C" void* ThreadDumper(void*) {
do { do {
Sleep(100000); Sleep(100000);
{ {
vector<CAddrReport> v = db.GetAll();
sort(v.begin(), v.end(), StatCompare);
FILE *f = fopen("dnsseed.dat.new","w+"); FILE *f = fopen("dnsseed.dat.new","w+");
if (f) { if (f) {
{ {
@ -279,8 +281,6 @@ extern "C" void* ThreadDumper(void*) {
rename("dnsseed.dat.new", "dnsseed.dat"); rename("dnsseed.dat.new", "dnsseed.dat");
} }
FILE *d = fopen("dnsseed.dump", "w"); FILE *d = fopen("dnsseed.dump", "w");
vector<CAddrReport> v = db.GetAll();
sort(v.begin(), v.end(), StatCompare);
fprintf(d, "# address \t%%(2h)\t%%(8h)\t%%(1d)\t%%(7d)\t%%(30d)\tblocks\tversion\n"); fprintf(d, "# address \t%%(2h)\t%%(8h)\t%%(1d)\t%%(7d)\t%%(30d)\tblocks\tversion\n");
double stat[5]={0,0,0,0,0}; double stat[5]={0,0,0,0,0};
for (vector<CAddrReport>::const_iterator it = v.begin(); it < v.end(); it++) { for (vector<CAddrReport>::const_iterator it = v.begin(); it < v.end(); it++) {