[tor-commits] [tor/master] Adding 'SIGNAL HEARTBEAT' message that causes unscheduled heartbeat.

nickm at torproject.org nickm at torproject.org
Tue Nov 25 17:49:20 UTC 2014


commit 8c135062e51b2ead38a756b045e7d243ffbda5a9
Author: rl1987 <rl1987 at sdf.lonestar.org>
Date:   Sun Nov 2 19:14:58 2014 +0200

    Adding 'SIGNAL HEARTBEAT' message that causes unscheduled heartbeat.
---
 changes/feature9503 |    4 ++++
 src/or/control.c    |    1 +
 src/or/main.c       |    3 +++
 src/or/or.h         |    1 +
 4 files changed, 9 insertions(+)

diff --git a/changes/feature9503 b/changes/feature9503
new file mode 100644
index 0000000..58ae67f
--- /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 e3f9131..5c65189 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 },
 };
 
diff --git a/src/or/main.c b/src/or/main.c
index 5a4e0a3..6a6e36a 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2137,6 +2137,9 @@ process_signal(uintptr_t sig)
       addressmap_clear_transient();
       control_event_signal(sig);
       break;
+    case SIGHEARTBEAT:
+      log_heartbeat(time(NULL));
+      break;
   }
 }
 
diff --git a/src/or/or.h b/src/or/or.h
index 6170c21..a0d3043 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





More information about the tor-commits mailing list