diff options
-rw-r--r-- | src/net.cpp | 5 | ||||
-rw-r--r-- | src/util.h | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp index 0adf26ef0d..5418c3de40 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -22,6 +22,9 @@ #include <miniupnpc/upnperrors.h> #endif +// Dump addresses to peers.dat every 15 minutes (900s) +#define DUMP_ADDRESSES_INTERVAL 900 + using namespace std; using namespace boost; @@ -1730,7 +1733,7 @@ void StartNode(boost::thread_group& threadGroup) threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "msghand", &ThreadMessageHandler)); // Dump network addresses - threadGroup.create_thread(boost::bind(&LoopForever<void (*)()>, "dumpaddr", &DumpAddresses, 10000)); + threadGroup.create_thread(boost::bind(&LoopForever<void (*)()>, "dumpaddr", &DumpAddresses, DUMP_ADDRESSES_INTERVAL * 1000)); } bool StopNode() diff --git a/src/util.h b/src/util.h index 86a38ad331..bee2749c16 100644 --- a/src/util.h +++ b/src/util.h @@ -527,7 +527,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<void (*)()>, "dumpaddr", &DumpAddresses, 10000)); +// new boost::thread(boost::bind(&LoopForever<void (*)()>, "dumpaddr", &DumpAddresses, 900000)); // or maybe: // boost::function<void()> f = boost::bind(&FunctionWithArg, argument); // threadGroup.create_thread(boost::bind(&LoopForever<boost::function<void()> >, "nothing", f, milliseconds)); @@ -540,8 +540,8 @@ template <typename Callable> void LoopForever(const char* name, Callable func, { while (1) { - func(); MilliSleep(msecs); + func(); } } catch (boost::thread_interrupted) |