From ac268a83408e1450544db2f23f364dfa3dee5042 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 6 Apr 2005 00:46:57 +0000 Subject: [PATCH] Fix Tor for no-threading compilation: move connection_unregister from _connection_free to connection_free. svn:r4013 --- src/or/connection.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/or/connection.c b/src/or/connection.c index 43fbea35cf..5bd388af30 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -171,8 +171,6 @@ _connection_free(connection_t *conn) { tor_free(conn->chosen_exit_name); if (connection_speaks_cells(conn)) { - if (conn->state == OR_CONN_STATE_OPEN) - directory_set_dirty(); if (conn->tls) { tor_tls_free(conn->tls); conn->tls = NULL; @@ -183,8 +181,8 @@ _connection_free(connection_t *conn) { crypto_free_pk_env(conn->identity_pkey); tor_free(conn->nickname); tor_free(conn->socks_request); - - connection_unregister(conn); + tor_free(conn->read_event); /* Probably already freed by connection_free. */ + tor_free(conn->write_event); /* Probably already freed by connection_free. */ if (conn->s >= 0) { log_fn(LOG_INFO,"closing fd %d.",conn->s); @@ -201,6 +199,11 @@ void connection_free(connection_t *conn) { tor_assert(conn); tor_assert(!connection_is_on_closeable_list(conn)); tor_assert(!connection_in_array(conn)); + if (connection_speaks_cells(conn)) { + if (conn->state == OR_CONN_STATE_OPEN) + directory_set_dirty(); + } + connection_unregister(conn); _connection_free(conn); }