Loading src/common/util.h +6 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ #include <time.h> #endif /** Replace assert() with a variant that sends failures to the log before /* Replace assert() with a variant that sends failures to the log before * calling assert() normally. */ #ifdef NDEBUG Loading @@ -47,6 +47,11 @@ } } while (0) #endif /** Define this if you want Tor to crash when any problem comes up, * so you can get a coredump and track things down. */ // #define tor_fragile_assert() tor_assert(0) #define tor_fragile_assert() /* Memory management */ void *_tor_malloc(const char *file, const int line, size_t size); void *_tor_malloc_zero(const char *file, const int line, size_t size); Loading src/or/circuitbuild.c +2 −6 Original line number Diff line number Diff line Loading @@ -820,9 +820,7 @@ static int new_route_len(double cw, uint8_t purpose, smartlist_t *routers) { routelen = 4; else { log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } #endif Loading Loading @@ -1138,9 +1136,7 @@ choose_good_exit_server(uint8_t purpose, routerlist_t *dir, return r; } log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return NULL; } Loading src/or/circuituse.c +1 −3 Original line number Diff line number Diff line Loading @@ -731,9 +731,7 @@ circuit_launch_by_router(uint8_t purpose, routerinfo_t *exit, default: log_fn(LOG_WARN,"Bug: unexpected purpose %d when cannibalizing a general circ.", purpose); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return NULL; } return circ; Loading src/or/connection.c +7 −21 Original line number Diff line number Diff line Loading @@ -270,9 +270,7 @@ void connection_about_to_close_connection(connection_t *conn) if (CONN_IS_EDGE(conn)) { if (!conn->has_sent_end) { log_fn(LOG_WARN,"Harmless bug: Edge connection (marked at %s:%d) hasn't sent end yet?", conn->marked_for_close_file, conn->marked_for_close); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); } } Loading Loading @@ -345,9 +343,7 @@ void connection_close_immediate(connection_t *conn) assert_connection_ok(conn,0); if (conn->s < 0) { log_fn(LOG_WARN,"Bug: Attempt to close already-closed connection."); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return; } if (conn->outbuf_flushlen) { Loading Loading @@ -380,9 +376,7 @@ _connection_mark_for_close(connection_t *conn, int line, const char *file) log(LOG_WARN, "Duplicate call to connection_mark_for_close at %s:%d" " (first at %s:%d)", file, line, conn->marked_for_close_file, conn->marked_for_close); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return; } Loading Loading @@ -1572,9 +1566,7 @@ static int connection_process_inbuf(connection_t *conn, int package_partial) { return connection_control_process_inbuf(conn); default: log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } } Loading Loading @@ -1607,9 +1599,7 @@ static int connection_finished_flushing(connection_t *conn) { return connection_control_finished_flushing(conn); default: log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } } Loading @@ -1633,9 +1623,7 @@ static int connection_finished_connecting(connection_t *conn) return connection_dir_finished_connecting(conn); default: log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } } Loading @@ -1658,9 +1646,7 @@ static int connection_reached_eof(connection_t *conn) return connection_control_reached_eof(conn); default: log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } } Loading src/or/connection_edge.c +3 −9 Original line number Diff line number Diff line Loading @@ -129,9 +129,7 @@ int connection_edge_process_inbuf(connection_t *conn, int package_partial) { return 0; } log_fn(LOG_WARN,"Bug: Got unexpected state %d. Closing.",conn->state); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); connection_edge_end(conn, END_STREAM_REASON_INTERNAL, conn->cpath_layer); connection_mark_for_close(conn); return -1; Loading Loading @@ -176,9 +174,7 @@ connection_edge_end(connection_t *conn, char reason, crypt_path_t *cpath_layer) if (conn->has_sent_end) { log_fn(LOG_WARN,"Harmless bug: Calling connection_edge_end (reason %d) on an already ended stream?", reason); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } Loading Loading @@ -251,9 +247,7 @@ int connection_edge_finished_flushing(connection_t *conn) { return 0; default: log_fn(LOG_WARN,"BUG: called in unexpected state %d.", conn->state); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } return 0; Loading Loading
src/common/util.h +6 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ #include <time.h> #endif /** Replace assert() with a variant that sends failures to the log before /* Replace assert() with a variant that sends failures to the log before * calling assert() normally. */ #ifdef NDEBUG Loading @@ -47,6 +47,11 @@ } } while (0) #endif /** Define this if you want Tor to crash when any problem comes up, * so you can get a coredump and track things down. */ // #define tor_fragile_assert() tor_assert(0) #define tor_fragile_assert() /* Memory management */ void *_tor_malloc(const char *file, const int line, size_t size); void *_tor_malloc_zero(const char *file, const int line, size_t size); Loading
src/or/circuitbuild.c +2 −6 Original line number Diff line number Diff line Loading @@ -820,9 +820,7 @@ static int new_route_len(double cw, uint8_t purpose, smartlist_t *routers) { routelen = 4; else { log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } #endif Loading Loading @@ -1138,9 +1136,7 @@ choose_good_exit_server(uint8_t purpose, routerlist_t *dir, return r; } log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return NULL; } Loading
src/or/circuituse.c +1 −3 Original line number Diff line number Diff line Loading @@ -731,9 +731,7 @@ circuit_launch_by_router(uint8_t purpose, routerinfo_t *exit, default: log_fn(LOG_WARN,"Bug: unexpected purpose %d when cannibalizing a general circ.", purpose); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return NULL; } return circ; Loading
src/or/connection.c +7 −21 Original line number Diff line number Diff line Loading @@ -270,9 +270,7 @@ void connection_about_to_close_connection(connection_t *conn) if (CONN_IS_EDGE(conn)) { if (!conn->has_sent_end) { log_fn(LOG_WARN,"Harmless bug: Edge connection (marked at %s:%d) hasn't sent end yet?", conn->marked_for_close_file, conn->marked_for_close); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); } } Loading Loading @@ -345,9 +343,7 @@ void connection_close_immediate(connection_t *conn) assert_connection_ok(conn,0); if (conn->s < 0) { log_fn(LOG_WARN,"Bug: Attempt to close already-closed connection."); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return; } if (conn->outbuf_flushlen) { Loading Loading @@ -380,9 +376,7 @@ _connection_mark_for_close(connection_t *conn, int line, const char *file) log(LOG_WARN, "Duplicate call to connection_mark_for_close at %s:%d" " (first at %s:%d)", file, line, conn->marked_for_close_file, conn->marked_for_close); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return; } Loading Loading @@ -1572,9 +1566,7 @@ static int connection_process_inbuf(connection_t *conn, int package_partial) { return connection_control_process_inbuf(conn); default: log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } } Loading Loading @@ -1607,9 +1599,7 @@ static int connection_finished_flushing(connection_t *conn) { return connection_control_finished_flushing(conn); default: log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } } Loading @@ -1633,9 +1623,7 @@ static int connection_finished_connecting(connection_t *conn) return connection_dir_finished_connecting(conn); default: log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } } Loading @@ -1658,9 +1646,7 @@ static int connection_reached_eof(connection_t *conn) return connection_control_reached_eof(conn); default: log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } } Loading
src/or/connection_edge.c +3 −9 Original line number Diff line number Diff line Loading @@ -129,9 +129,7 @@ int connection_edge_process_inbuf(connection_t *conn, int package_partial) { return 0; } log_fn(LOG_WARN,"Bug: Got unexpected state %d. Closing.",conn->state); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); connection_edge_end(conn, END_STREAM_REASON_INTERNAL, conn->cpath_layer); connection_mark_for_close(conn); return -1; Loading Loading @@ -176,9 +174,7 @@ connection_edge_end(connection_t *conn, char reason, crypt_path_t *cpath_layer) if (conn->has_sent_end) { log_fn(LOG_WARN,"Harmless bug: Calling connection_edge_end (reason %d) on an already ended stream?", reason); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } Loading Loading @@ -251,9 +247,7 @@ int connection_edge_finished_flushing(connection_t *conn) { return 0; default: log_fn(LOG_WARN,"BUG: called in unexpected state %d.", conn->state); #ifdef TOR_FRAGILE tor_assert(0); #endif tor_fragile_assert(); return -1; } return 0; Loading