Browse Source

Implement NEWNYM. Nick, did I do a bad thing?

svn:r6105
Roger Dingledine 19 years ago
parent
commit
44107f6ec4
3 changed files with 11 additions and 0 deletions
  1. 2 0
      src/or/control.c
  2. 6 0
      src/or/main.c
  3. 3 0
      src/or/or.h

+ 2 - 0
src/or/control.c

@@ -1118,6 +1118,8 @@ handle_control_signal(connection_t *conn, uint32_t len,
       sig = SIGUSR2;
       sig = SIGUSR2;
     else if (!strcasecmp(s, "HALT") || !strcasecmp(s, "TERM"))
     else if (!strcasecmp(s, "HALT") || !strcasecmp(s, "TERM"))
       sig = SIGTERM;
       sig = SIGTERM;
+    else if (!strcasecmp(s, "NEWNYM"))
+      sig = SIGNEWNYM;
     else {
     else {
       connection_printf_to_buf(conn, "552 Unrecognized signal code \"%s\"\r\n",
       connection_printf_to_buf(conn, "552 Unrecognized signal code \"%s\"\r\n",
                                s);
                                s);

+ 6 - 0
src/or/main.c

@@ -1220,6 +1220,9 @@ control_signal_act(int the_signal)
     case 15:
     case 15:
       signal_callback(0,0,(void*)(uintptr_t)SIGTERM);
       signal_callback(0,0,(void*)(uintptr_t)SIGTERM);
       break;
       break;
+    case SIGNEWNYM:
+      signal_callback(0,0,(void*)(uintptr_t)SIGNEWNYM);
+      break;
     default:
     default:
       return -1;
       return -1;
     }
     }
@@ -1274,6 +1277,9 @@ signal_callback(int fd, short events, void *arg)
                                                 zombies */
                                                 zombies */
       break;
       break;
 #endif
 #endif
+    case SIGNEWNYM:
+      circuit_expire_all_dirty_circs();
+      break;
   }
   }
 }
 }
 
 

+ 3 - 0
src/or/or.h

@@ -157,6 +157,9 @@
 #ifndef SIGTERM
 #ifndef SIGTERM
 #define SIGTERM 15
 #define SIGTERM 15
 #endif
 #endif
+/* Controller signals start at a high number so we don't
+ * conflict with system-defined signals. */
+#define SIGNEWNYM 129
 
 
 #if (SIZEOF_CELL_T != 0)
 #if (SIZEOF_CELL_T != 0)
 /* On Irix, stdlib.h defines a cell_t type, so we need to make sure
 /* On Irix, stdlib.h defines a cell_t type, so we need to make sure