From 44107f6ec4d4cd9a4e8dc2d509bebb0cb5fee301 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Thu, 9 Mar 2006 00:18:16 +0000 Subject: Implement NEWNYM. Nick, did I do a bad thing? svn:r6105 --- src/or/control.c | 2 ++ src/or/main.c | 6 ++++++ src/or/or.h | 3 +++ 3 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/or/control.c b/src/or/control.c index aa839012c2..10e3a80219 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1118,6 +1118,8 @@ handle_control_signal(connection_t *conn, uint32_t len, sig = SIGUSR2; else if (!strcasecmp(s, "HALT") || !strcasecmp(s, "TERM")) sig = SIGTERM; + else if (!strcasecmp(s, "NEWNYM")) + sig = SIGNEWNYM; else { connection_printf_to_buf(conn, "552 Unrecognized signal code \"%s\"\r\n", s); diff --git a/src/or/main.c b/src/or/main.c index 9bcd31b9b3..148c6e0307 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1220,6 +1220,9 @@ control_signal_act(int the_signal) case 15: signal_callback(0,0,(void*)(uintptr_t)SIGTERM); break; + case SIGNEWNYM: + signal_callback(0,0,(void*)(uintptr_t)SIGNEWNYM); + break; default: return -1; } @@ -1274,6 +1277,9 @@ signal_callback(int fd, short events, void *arg) zombies */ break; #endif + case SIGNEWNYM: + circuit_expire_all_dirty_circs(); + break; } } diff --git a/src/or/or.h b/src/or/or.h index 40e2a27e50..43f4fdbfd4 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -157,6 +157,9 @@ #ifndef SIGTERM #define SIGTERM 15 #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) /* On Irix, stdlib.h defines a cell_t type, so we need to make sure -- cgit v1.2.3-54-g00ecf