From 65c20dbf558d9a8e9856017568016c92473dada4 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 24 Jun 2013 00:23:28 +0200 Subject: Dump addresses every 15 minutes instead of 10 seconds --- src/net.cpp | 5 ++++- src/util.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/net.cpp b/src/net.cpp index 54ed1d9b51..30215d1bc5 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -21,6 +21,9 @@ #include #endif +// Dump addresses to peers.dat every 15 minutes (900s) +#define DUMP_ADDRESSES_INTERVAL 900 + using namespace std; using namespace boost; @@ -1855,7 +1858,7 @@ void StartNode(boost::thread_group& threadGroup) threadGroup.create_thread(boost::bind(&TraceThread, "msghand", &ThreadMessageHandler)); // Dump network addresses - threadGroup.create_thread(boost::bind(&LoopForever, "dumpaddr", &DumpAddresses, 10000)); + threadGroup.create_thread(boost::bind(&LoopForever, "dumpaddr", &DumpAddresses, DUMP_ADDRESSES_INTERVAL * 1000)); } bool StopNode() diff --git a/src/util.h b/src/util.h index 51a694483a..3f3dd0f487 100644 --- a/src/util.h +++ b/src/util.h @@ -531,7 +531,7 @@ inline uint32_t ByteReverse(uint32_t value) // Standard wrapper for do-something-forever thread functions. // "Forever" really means until the thread is interrupted. // Use it like: -// new boost::thread(boost::bind(&LoopForever, "dumpaddr", &DumpAddresses, 10000)); +// new boost::thread(boost::bind(&LoopForever, "dumpaddr", &DumpAddresses, 900000)); // or maybe: // boost::function f = boost::bind(&FunctionWithArg, argument); // threadGroup.create_thread(boost::bind(&LoopForever >, "nothing", f, milliseconds)); @@ -544,8 +544,8 @@ template void LoopForever(const char* name, Callable func, { while (1) { - func(); MilliSleep(msecs); + func(); } } catch (boost::thread_interrupted) -- cgit v1.2.3