From 14c8bc598b971d6ffe95c9cff20e6d22c13eb7ed Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 25 Aug 2003 20:57:23 +0000 Subject: [PATCH] Attempt to track down bug in conn->package_window svn:r415 --- src/or/circuit.c | 4 ++++ src/or/connection.c | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/or/circuit.c b/src/or/circuit.c index 9cbe660e23..9eb9cc10a8 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -405,6 +405,10 @@ void circuit_resume_edge_reading(circuit_t *circ, int edge_type, crypt_path_t *l (edge_type == EDGE_AP && conn->package_window > 0 && conn->cpath_layer == layer_hint)) { connection_start_reading(conn); connection_package_raw_inbuf(conn); /* handle whatever might still be on the inbuf */ + + /* If the circuit won't accept any more data, return without looking + * at any more of the streams. Any connections that should be stopped + * have already been stopped by connection_package_raw_inbuf. */ if(circuit_consider_stop_edge_reading(circ, edge_type, layer_hint)) return; } diff --git a/src/or/connection.c b/src/or/connection.c index 93df99f7ef..e781ff24c1 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -564,6 +564,7 @@ int connection_package_raw_inbuf(connection_t *conn) { assert(!connection_speaks_cells(conn)); repeat_connection_package_raw_inbuf: + assert(conn->package_window > 0); circ = circuit_get_by_conn(conn); if(!circ) { @@ -620,13 +621,12 @@ repeat_connection_package_raw_inbuf: } assert(conn->package_window > 0); - conn->package_window--; -// if(--conn->package_window <= 0) { /* is it 0 after decrement? */ -// connection_stop_reading(conn); -// log_fn(LOG_DEBUG,"conn->package_window reached 0."); -// circuit_consider_stop_edge_reading(circ, conn->type, conn->cpath_layer); -// return 0; /* don't process the inbuf any more */ -// } + if(--conn->package_window <= 0) { /* is it 0 after decrement? */ + connection_stop_reading(conn); + log_fn(LOG_DEBUG,"conn->package_window reached 0."); + circuit_consider_stop_edge_reading(circ, conn->type, conn->cpath_layer); + return 0; /* don't process the inbuf any more */ + } log_fn(LOG_DEBUG,"conn->package_window is now %d",conn->package_window); /* handle more if there's more, or return 0 if there isn't */