diff options
author | Roger Dingledine <arma@torproject.org> | 2005-03-23 02:52:55 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-03-23 02:52:55 +0000 |
commit | 7373042a7b5349bd45b3ce7c6b99a694330a65ad (patch) | |
tree | c47b37426c26c9ddbc5c6d5e38171b7a9a8c5ea0 /src | |
parent | a523439cbc131facdcde10f6c25edb1a8f995724 (diff) | |
download | tor-7373042a7b5349bd45b3ce7c6b99a694330a65ad.tar.gz tor-7373042a7b5349bd45b3ce7c6b99a694330a65ad.zip |
fix assert triggers (bugs 109 and 96), and put in some
debugging logs to notice future repeat bugs.
svn:r3826
Diffstat (limited to 'src')
-rw-r--r-- | src/or/connection.c | 6 | ||||
-rw-r--r-- | src/or/connection_edge.c | 7 | ||||
-rw-r--r-- | src/or/relay.c | 11 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 1f09bc43a9..bc8864aba4 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1616,8 +1616,10 @@ void assert_connection_ok(connection_t *conn, time_t now) tor_assert(conn->socks_request); if (conn->state == AP_CONN_STATE_OPEN) { tor_assert(conn->socks_request->has_finished); - tor_assert(conn->cpath_layer); - assert_cpath_layer_ok(conn->cpath_layer); + if (!conn->marked_for_close) { + tor_assert(conn->cpath_layer); + assert_cpath_layer_ok(conn->cpath_layer); + } } } else { tor_assert(!conn->socks_request); diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index db301a715b..2d685e1f13 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -115,6 +115,7 @@ int connection_edge_destroy(uint16_t circ_id, connection_t *conn) { conn->has_sent_end = 1; /* we're closing the circuit, nothing to send to */ connection_mark_for_close(conn); conn->hold_open_until_flushed = 1; + conn->cpath_layer = NULL; return 0; } @@ -141,6 +142,12 @@ connection_edge_end(connection_t *conn, char reason, crypt_path_t *cpath_layer) return -1; } + if (conn->marked_for_close) { + log_fn(LOG_WARN,"Bug: called on conn that's already marked for close at %s:%d.", + conn->marked_for_close_file, conn->marked_for_close); + return 0; + } + payload[0] = reason; if (reason == END_STREAM_REASON_EXITPOLICY) { /* this is safe even for rend circs, because they never fail diff --git a/src/or/relay.c b/src/or/relay.c index 5651fd35e1..399587dcd2 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -407,6 +407,12 @@ int connection_edge_send_command(connection_t *fromconn, circuit_t *circ, relay_header_t rh; int cell_direction; + if (fromconn->marked_for_close) { + log_fn(LOG_WARN,"Bug: called on conn that's already marked for close at %s:%d.", + fromconn->marked_for_close_file, fromconn->marked_for_close); + return 0; + } + if (!circ) { log_fn(LOG_WARN,"no circ. Closing conn."); tor_assert(fromconn); @@ -974,6 +980,11 @@ int connection_edge_package_raw_inbuf(connection_t *conn, int package_partial) { tor_assert(conn); tor_assert(!connection_speaks_cells(conn)); + if (conn->marked_for_close) { + log_fn(LOG_WARN,"Bug: called on conn that's already marked for close at %s:%d.", + conn->marked_for_close_file, conn->marked_for_close); + return 0; + } repeat_connection_edge_package_raw_inbuf: |