Browse Source

Merge branch 'feature9503_squashed'

Nick Mathewson 10 years ago
parent
commit
3a91a08e21
4 changed files with 13 additions and 0 deletions
  1. 4 0
      changes/feature9503
  2. 4 0
      src/or/control.c
  3. 4 0
      src/or/main.c
  4. 1 0
      src/or/or.h

+ 4 - 0
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.

+ 4 - 0
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);

+ 4 - 0
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;
   }
 }
 

+ 1 - 0
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