[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r8828: Resolve bug 347: translate v0 controller signal numbers into (in tor/trunk: . src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r8828: Resolve bug 347: translate v0 controller signal numbers into (in tor/trunk: . src/or)
- From: nickm@xxxxxxxx
- Date: Wed, 25 Oct 2006 17:39:43 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 25 Oct 2006 17:39:50 -0400
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2006-10-25 17:39:42 -0400 (Wed, 25 Oct 2006)
New Revision: 8828
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/or/control.c
tor/trunk/src/or/main.c
tor/trunk/src/or/or.h
Log:
r9386@Kushana: nickm | 2006-10-25 17:35:38 -0400
Resolve bug 347: translate v0 controller signal numbers into internal signal numbers; leave v1 signal numbers alone.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r9386] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2006-10-25 04:30:58 UTC (rev 8827)
+++ tor/trunk/ChangeLog 2006-10-25 21:39:42 UTC (rev 8828)
@@ -64,6 +64,8 @@
requests will now get an error rather than timing out.
- Resolve two memory leaks when rebuilding the on-disk router cache
(reported by fookoowa).
+ - Controller signals now work on non-Unix platforms that don't define
+ SIGUSR1 and SIGUSR2 the way we expect.
Changes in version 0.1.2.2-alpha - 2006-10-07
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2006-10-25 04:30:58 UTC (rev 8827)
+++ tor/trunk/src/or/control.c 2006-10-25 21:39:42 UTC (rev 8828)
@@ -1252,6 +1252,18 @@
return 0;
} else {
sig = (uint8_t)body[0];
+ switch (sig)
+ {
+ case 1: sig = SIGHUP; break;
+ case 2: sig = SIGINT; break;
+ case 10: sig = SIGUSR1; break;
+ case 12: sig = SIGUSR2; break;
+ case 15: sig = SIGTERM; break;
+ case SIGNEWNYM: break;
+ default:
+ send_control0_error(conn, ERR_SYNTAX, "Unrecognized signal number.");
+ return 0;
+ }
}
} else {
int n = 0;
@@ -1281,17 +1293,9 @@
return 0;
}
- if (!control_signal_check(sig)) {
- if (STATE_IS_V0(conn->_base.state))
- send_control0_error(conn, ERR_SYNTAX, "Unrecognized signal number.");
- else
- connection_write_str_to_buf("551 Unable to act on signal\r\n",
- conn);
- } else {
- /* Send DONE first, in case the signal makes us shut down. */
- send_control_done(conn);
- control_signal_act(sig);
- }
+ /* Send DONE first, in case the signal makes us shut down. */
+ send_control_done(conn);
+ control_signal_act(sig);
return 0;
}
Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c 2006-10-25 04:30:58 UTC (rev 8827)
+++ tor/trunk/src/or/main.c 2006-10-25 21:39:42 UTC (rev 8828)
@@ -1229,24 +1229,6 @@
}
}
-/* DOCDOC */
-int
-control_signal_check(int the_signal)
-{
- switch (the_signal)
- {
- case 1:
- case 2:
- case 10:
- case 12:
- case 15:
- case SIGNEWNYM:
- return 1;
- default:
- return 0;
- }
-}
-
/** Used to implement the SIGNAL control command: if we accept
* <b>the_signal</b> as a remote pseudo-signal, act on it. */
/* We don't re-use catch() here because:
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2006-10-25 04:30:58 UTC (rev 8827)
+++ tor/trunk/src/or/or.h 2006-10-25 21:39:42 UTC (rev 8828)
@@ -2273,7 +2273,6 @@
void directory_all_unreachable(time_t now);
void directory_info_has_arrived(time_t now, int from_cache);
-int control_signal_check(int the_signal);
void control_signal_act(int the_signal);
void handle_signals(int is_parent);
void tor_cleanup(void);