Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/main.cpp
| Show First 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | extern "C" void *ThreadDumper(void *data) { | ||||
| UninterruptibleSleep(std::min(10s, dumpInterval)); | UninterruptibleSleep(std::min(10s, dumpInterval)); | ||||
| do { | 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 = fsbridge::fopen("dnsseed.dat.new", "w+"); | FILE *f = fsbridge::fopen("dnsseed.dat.new", "w+"); | ||||
| if (f) { | if (f) { | ||||
| { | { | ||||
| CAutoFile cf(f, SER_DISK, CLIENT_VERSION); | AutoFile cf(f); | ||||
| cf << db; | cf << db; | ||||
| } | } | ||||
| rename("dnsseed.dat.new", "dnsseed.dat"); | rename("dnsseed.dat.new", "dnsseed.dat"); | ||||
| } | } | ||||
| std::ofstream d{"dnsseed.dump"}; | std::ofstream d{"dnsseed.dump"}; | ||||
| tfm::format( | tfm::format( | ||||
| d, "# address good " | d, "# address good " | ||||
| "lastSuccess %%(2h) %%(8h) %%(1d) %%(7d) " | "lastSuccess %%(2h) %%(8h) %%(1d) %%(7d) " | ||||
| ▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | int main(int argc, char **argv) { | ||||
| } | } | ||||
| if (fDNS && opts.mbox.empty()) { | if (fDNS && opts.mbox.empty()) { | ||||
| tfm::format(std::cerr, "No e-mail address set. Please use -m.\n"); | tfm::format(std::cerr, "No e-mail address set. Please use -m.\n"); | ||||
| return EXIT_FAILURE; | return EXIT_FAILURE; | ||||
| } | } | ||||
| FILE *f = fsbridge::fopen("dnsseed.dat", "r"); | FILE *f = fsbridge::fopen("dnsseed.dat", "r"); | ||||
| if (f) { | if (f) { | ||||
| tfm::format(std::cout, "Loading dnsseed.dat..."); | tfm::format(std::cout, "Loading dnsseed.dat..."); | ||||
| CAutoFile cf(f, SER_DISK, CLIENT_VERSION); | AutoFile cf(f); | ||||
| cf >> db; | cf >> db; | ||||
| if (opts.fWipeBan) { | if (opts.fWipeBan) { | ||||
| db.banned.clear(); | db.banned.clear(); | ||||
| tfm::format(std::cout, "Ban list wiped..."); | tfm::format(std::cout, "Ban list wiped..."); | ||||
| } | } | ||||
| if (opts.fWipeIgnore) { | if (opts.fWipeIgnore) { | ||||
| db.ResetIgnores(); | db.ResetIgnores(); | ||||
| tfm::format(std::cout, "Ignore list wiped..."); | tfm::format(std::cout, "Ignore list wiped..."); | ||||
| ▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines | |||||