Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Split big assert statement into decision tree with explanations
Loading branch information
Showing
1 changed file
with
23 additions
and
9 deletions .
+23
−9
src/or/connection.c
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -5093,15 +5093,29 @@ assert_connection_ok(connection_t *conn, time_t now)
tor_assert (!SOCKET_OK (conn->s ));
if (conn->outbuf_flushlen > 0 ) {
/* With optimistic data, we may have queued data in
* EXIT_CONN_STATE_RESOLVING while the conn is not yet marked to writing.
* */
tor_assert ((conn->type == CONN_TYPE_EXIT &&
conn->state == EXIT_CONN_STATE_RESOLVING) ||
connection_is_writing (conn) ||
conn->write_blocked_on_bw ||
(CONN_IS_EDGE (conn) &&
TO_EDGE_CONN (conn)->edge_blocked_on_circ ));
if (CONN_IS_EDGE (conn)) {
if (conn->type == CONN_TYPE_EXIT) {
/* With optimistic data, we may have queued data in
* EXIT_CONN_STATE_RESOLVING while the conn is not yet marked to
* writing.
* */
if (conn->state != EXIT_CONN_STATE_RESOLVING) {
tor_assertf (connection_is_writing (conn) || conn->write_blocked_on_bw ,
" Exit connection %llu is neither resolving, "
" inor writing out t's nonempty outbuf" ,
conn->global_identifier );
}
} else if (TO_EDGE_CONN (conn)->edge_blocked_on_circ == 0 ) {
tor_assertf (connection_is_writing (conn) || conn->write_blocked_on_bw ,
" Edge connection %llu is neither blocked nor "
" writing out it's nonempty outbuf." ,
conn->global_identifier );
}
} else {
tor_assertf (connection_is_writing (conn) || conn->write_blocked_on_bw ,
" Connection %llu is not writing out it's nonempty outbuf" ,
conn->global_identifier );
}
}
if (conn->hold_open_until_flushed )
Toggle all file notes
Toggle all file annotations