summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-10-21 04:15:28 +0000
committerRoger Dingledine <arma@torproject.org>2007-10-21 04:15:28 +0000
commitb4a28f8b8307e690b49b6f238ae7c289757f0a6e (patch)
tree9d077e13a0a25ccd9babfa645238c4f52419fa6f /src/or/control.c
parent5ada3cc09ae7c5bf63acdc78940b0f5b2e5d2411 (diff)
downloadtor-b4a28f8b8307e690b49b6f238ae7c289757f0a6e.tar.gz
tor-b4a28f8b8307e690b49b6f238ae7c289757f0a6e.zip
Bugfix on r7072, which turned out to basically be a no-op:
Respond to INT and TERM SIGNAL commands before we execute the signal, in case the signal shuts us down. We had a patch in 0.1.2.1-alpha that tried to do this by queueing the response on the connection's buffer before shutting down, but that really isn't the same thing. Bug located by Matt Edman. This is a bug in 0.1.2.x too, but there's no way we should backport this fix. Speaking of which, can somebody double-check it? :) svn:r12070
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 249406de88..76b53e8ba7 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1119,8 +1119,10 @@ handle_control_signal(control_connection_t *conn, uint32_t len,
if (sig<0)
return 0;
- /* Send DONE first, in case the signal makes us shut down. */
send_control_done(conn);
+ /* Flush the "done" first if the signal might make us shut down. */
+ if (sig == SIGTERM || sig == SIGINT)
+ connection_handle_write(TO_CONN(conn), 1);
control_signal_act(sig);
return 0;
}