Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/main.cpp
#include "bitcoin.h" | #include "bitcoin.h" | ||||
#include "clientversion.h" | |||||
#include "db.h" | #include "db.h" | ||||
#include "streams.h" | |||||
#include <algorithm> | #include <algorithm> | ||||
#include <atomic> | #include <atomic> | ||||
#include <cstdio> | #include <cstdio> | ||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <getopt.h> | #include <getopt.h> | ||||
#include <pthread.h> | #include <pthread.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
▲ Show 20 Lines • Show All 344 Lines • ▼ Show 20 Lines | do { | ||||
} | } | ||||
{ | { | ||||
std::vector<CAddrReport> v = db.GetAll(); | std::vector<CAddrReport> v = db.GetAll(); | ||||
sort(v.begin(), v.end(), StatCompare); | sort(v.begin(), v.end(), StatCompare); | ||||
FILE *f = fopen("dnsseed.dat.new", "w+"); | FILE *f = fopen("dnsseed.dat.new", "w+"); | ||||
if (f) { | if (f) { | ||||
{ | { | ||||
CAutoFile cf(f); | CAutoFile cf(f, SER_DISK, CLIENT_VERSION); | ||||
cf << db; | cf << db; | ||||
} | } | ||||
rename("dnsseed.dat.new", "dnsseed.dat"); | rename("dnsseed.dat.new", "dnsseed.dat"); | ||||
} | } | ||||
FILE *d = fopen("dnsseed.dump", "w"); | FILE *d = fopen("dnsseed.dump", "w"); | ||||
fprintf(d, "# address good " | fprintf(d, "# address good " | ||||
"lastSuccess %%(2h) %%(8h) %%(1d) %%(7d) " | "lastSuccess %%(2h) %%(8h) %%(1d) %%(7d) " | ||||
"%%(30d) blocks svcs version\n"); | "%%(30d) blocks svcs version\n"); | ||||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | int main(int argc, char **argv) { | ||||
} | } | ||||
if (fDNS && !opts.mbox) { | if (fDNS && !opts.mbox) { | ||||
fprintf(stderr, "No e-mail address set. Please use -m.\n"); | fprintf(stderr, "No e-mail address set. Please use -m.\n"); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
FILE *f = fopen("dnsseed.dat", "r"); | FILE *f = fopen("dnsseed.dat", "r"); | ||||
if (f) { | if (f) { | ||||
printf("Loading dnsseed.dat..."); | printf("Loading dnsseed.dat..."); | ||||
CAutoFile cf(f); | CAutoFile cf(f, SER_DISK, CLIENT_VERSION); | ||||
cf >> db; | cf >> db; | ||||
if (opts.fWipeBan) db.banned.clear(); | if (opts.fWipeBan) db.banned.clear(); | ||||
if (opts.fWipeIgnore) db.ResetIgnores(); | if (opts.fWipeIgnore) db.ResetIgnores(); | ||||
printf("done\n"); | printf("done\n"); | ||||
} | } | ||||
pthread_t threadDns, threadSeed, threadDump, threadStats; | pthread_t threadDns, threadSeed, threadDump, threadStats; | ||||
if (fDNS) { | if (fDNS) { | ||||
printf("Starting %i DNS threads for %s on %s (port %i)...", | printf("Starting %i DNS threads for %s on %s (port %i)...", | ||||
Show All 29 Lines |