diff options
-rw-r--r-- | changes/feature9503 | 4 | ||||
-rw-r--r-- | src/or/control.c | 4 | ||||
-rw-r--r-- | src/or/main.c | 4 | ||||
-rw-r--r-- | src/or/or.h | 1 |
4 files changed, 13 insertions, 0 deletions
diff --git a/changes/feature9503 b/changes/feature9503 new file mode 100644 index 0000000000..58ae67f184 --- /dev/null +++ b/changes/feature9503 @@ -0,0 +1,4 @@ + o Minor features (controller): + - Add a "SIGNAL HEARTBEAT" Tor controller command that provokes + writing unscheduled heartbeat message to the log. Implements + feature 9503. diff --git a/src/or/control.c b/src/or/control.c index 72c62277f6..dc67588d6a 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1263,6 +1263,7 @@ static const struct signal_t signal_table[] = { { SIGTERM, "INT" }, { SIGNEWNYM, "NEWNYM" }, { SIGCLEARDNSCACHE, "CLEARDNSCACHE"}, + { SIGHEARTBEAT, "HEARTBEAT"}, { 0, NULL }, }; @@ -4454,6 +4455,9 @@ control_event_signal(uintptr_t signal) case SIGCLEARDNSCACHE: signal_string = "CLEARDNSCACHE"; break; + case SIGHEARTBEAT: + signal_string = "HEARTBEAT"; + break; default: log_warn(LD_BUG, "Unrecognized signal %lu in control_event_signal", (unsigned long)signal); diff --git a/src/or/main.c b/src/or/main.c index 4571f682ff..54c739c4fd 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -2163,6 +2163,10 @@ process_signal(uintptr_t sig) addressmap_clear_transient(); control_event_signal(sig); break; + case SIGHEARTBEAT: + log_heartbeat(time(NULL)); + control_event_signal(sig); + break; } } diff --git a/src/or/or.h b/src/or/or.h index 8a9c1cf76e..bbb9192757 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -119,6 +119,7 @@ * conflict with system-defined signals. */ #define SIGNEWNYM 129 #define SIGCLEARDNSCACHE 130 +#define SIGHEARTBEAT 131 #if (SIZEOF_CELL_T != 0) /* On Irix, stdlib.h defines a cell_t type, so we need to make sure |