[tor-commits] [tor/master] Initialize consdiffmgr when running as (or becoming) a server.
nickm at torproject.org
nickm at torproject.org
Fri Apr 28 15:08:22 UTC 2017
commit fba8d7b222bf00cf2812362072e913c26a41b370
Author: Nick Mathewson <nickm at torproject.org>
Date: Tue Apr 25 19:53:00 2017 -0400
Initialize consdiffmgr when running as (or becoming) a server.
---
src/or/config.c | 10 ++++++++++
src/or/consdiffmgr.c | 3 ++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/or/config.c b/src/or/config.c
index a73f397..201cca7 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -74,6 +74,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "connection_or.h"
+#include "consdiffmgr.h"
#include "control.h"
#include "confparse.h"
#include "cpuworker.h"
@@ -1815,6 +1816,15 @@ options_act(const or_options_t *old_options)
return -1;
}
+ if (server_mode(options)) {
+ static int cdm_initialized = 0;
+ if (cdm_initialized == 0) {
+ cdm_initialized = 1;
+ consdiffmgr_configure(NULL);
+ consdiffmgr_validate();
+ }
+ }
+
if (init_control_cookie_authentication(options->CookieAuthentication) < 0) {
log_warn(LD_CONFIG,"Error creating control cookie authentication file.");
return -1;
diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c
index 41e37ac..160dcaf 100644
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@ -622,7 +622,8 @@ consdiffmgr_cleanup(void)
void
consdiffmgr_configure(const consdiff_cfg_t *cfg)
{
- memcpy(&consdiff_cfg, cfg, sizeof(consdiff_cfg));
+ if (cfg)
+ memcpy(&consdiff_cfg, cfg, sizeof(consdiff_cfg));
(void) cdm_cache_get();
}
More information about the tor-commits
mailing list