From 7903f24a8fbe8e45a4cd242efdf1ca64c0356d43 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 3 Nov 2015 15:52:10 -0800 Subject: Create periodic backup copies of controller.db in network controller from the main process itself to facilitate easier and safer backups of controller.db. --- controller/SqliteNetworkController.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'controller/SqliteNetworkController.hpp') diff --git a/controller/SqliteNetworkController.hpp b/controller/SqliteNetworkController.hpp index a3d5dfc7..0e2bb63e 100644 --- a/controller/SqliteNetworkController.hpp +++ b/controller/SqliteNetworkController.hpp @@ -39,6 +39,7 @@ #include "../node/Constants.hpp" #include "../node/NetworkController.hpp" #include "../node/Mutex.hpp" +#include "../osdep/Thread.hpp" // Number of in-memory last log entries to maintain per user #define ZT_SQLITENETWORKCONTROLLER_IN_MEMORY_LOG_SIZE 32 @@ -86,6 +87,10 @@ public: std::string &responseBody, std::string &responseContentType); + // threadMain() for backup thread -- do not call directly + void threadMain() + throw(); + private: enum IpAssignmentType { // IP assignment is a static IP address @@ -112,6 +117,8 @@ private: static void _circuitTestCallback(ZT_Node *node,ZT_CircuitTest *test,const ZT_CircuitTestReport *report); Node *_node; + Thread _backupThread; + volatile bool _backupThreadRun; std::string _dbPath; std::string _circuitTestPath; std::string _instanceId; -- cgit v1.2.3