From e617a34d589ac8ef26203ae90443a0e98f7032b1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 21 Jun 2011 10:22:54 -0400 Subject: Add, use a bufferevent-safe connection_flush() A couple of places in control.c were using connection_handle_write() to flush important stuff (the response to a SIGNAL command, an ERR-level status event) before Tor went down. But connection_handle_write() isn't meaningful for bufferevents, so we'd crash. This patch adds a new connection_flush() that works for all connection backends, and makes control.c use that instead. Fix for bug 3367; bugfix on 0.2.3.1-alpha. --- src/or/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/or/control.c') diff --git a/src/or/control.c b/src/or/control.c index 5e71a2ef94..e65cd260e2 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -600,7 +600,7 @@ send_control_event_string(uint16_t event, event_format_t which, else if (event == EVENT_STATUS_SERVER) is_err = !strcmpstart(msg, "STATUS_SERVER ERR "); if (is_err) - connection_handle_write(TO_CONN(control_conn), 1); + connection_flush(TO_CONN(control_conn)); } } } SMARTLIST_FOREACH_END(conn); @@ -1257,7 +1257,7 @@ handle_control_signal(control_connection_t *conn, uint32_t len, 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); + connection_flush(TO_CONN(conn)); process_signal(sig); -- cgit v1.2.3-54-g00ecf