[or-cvs] bugfix: onion pending queue now works
Roger Dingledine
arma at seul.org
Sun Sep 14 08:17:16 UTC 2003
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
circuit.c connection.c connection_edge.c main.c onion.c
Log Message:
bugfix: onion pending queue now works
and fixed recent memory leak
Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- circuit.c 25 Aug 2003 20:57:23 -0000 1.59
+++ circuit.c 14 Sep 2003 08:17:13 -0000 1.60
@@ -383,7 +383,7 @@
log_fn(LOG_DEBUG,"considered stream %d, not it.",*(int*)tmpconn->stream_id);
}
- log_fn(LOG_DEBUG,"Didn't recognize. Giving up.");
+ log_fn(LOG_DEBUG,"Didn't recognize on this iteration of decryption.");
return 0;
}
@@ -862,8 +862,8 @@
hop != circ->cpath && hop->state == CPATH_STATE_OPEN;
hop=hop->next) ;
if(hop == circ->cpath) { /* got an extended when we're all done? */
- log_fn(LOG_INFO,"got extended when circ already built? Weird.");
- return 0;
+ log_fn(LOG_INFO,"got extended when circ already built? Closing.");
+ return -1;
}
}
assert(hop->state == CPATH_STATE_AWAITING_KEYS);
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- connection.c 14 Sep 2003 06:43:18 -0000 1.90
+++ connection.c 14 Sep 2003 08:17:14 -0000 1.91
@@ -349,6 +349,8 @@
conn->pkey = pk;
conn->bandwidth = router->bandwidth;
conn->addr = router->addr, conn->port = router->or_port;
+ if(conn->address)
+ free(conn->address);
conn->address = strdup(router->address);
}
} else { /* it's an OP */
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- connection_edge.c 12 Sep 2003 22:45:31 -0000 1.18
+++ connection_edge.c 14 Sep 2003 08:17:14 -0000 1.19
@@ -102,13 +102,13 @@
return 0;
}
+/* an incoming relay cell has arrived. return -1 if you want to tear down the
+ * circuit, else 0. */
int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection_t *conn,
int edge_type, crypt_path_t *layer_hint) {
int relay_command;
static int num_seen=0;
- /* an incoming relay cell has arrived */
-
assert(cell && circ);
relay_command = CELL_RELAY_COMMAND(*cell);
@@ -148,7 +148,7 @@
if((edge_type == EDGE_AP && --layer_hint->deliver_window < 0) ||
(edge_type == EDGE_EXIT && --circ->deliver_window < 0)) {
log_fn(LOG_DEBUG,"circ deliver_window below 0. Killing.");
- return -1; /* XXX kill the whole circ? */
+ return -1;
}
log_fn(LOG_DEBUG,"circ deliver_window now %d.", edge_type == EDGE_AP ? layer_hint->deliver_window : circ->deliver_window);
@@ -165,6 +165,7 @@
return -1; /* somebody's breaking protocol. kill the whole circuit. */
}
+// printf("New text for buf (%d bytes): '%s'", cell->length - RELAY_HEADER_SIZE, cell->payload + RELAY_HEADER_SIZE);
if(connection_write_to_buf(cell->payload + RELAY_HEADER_SIZE,
cell->length - RELAY_HEADER_SIZE, conn) < 0) {
conn->marked_for_close = 1;
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- main.c 14 Sep 2003 06:43:18 -0000 1.92
+++ main.c 14 Sep 2003 08:17:14 -0000 1.93
@@ -256,7 +256,7 @@
* discussion of POLLIN vs POLLHUP */
conn = connection_array[i];
- //log_fn(LOG_DEBUG,"socket %d has something to read.",conn->s);
+ //log_fn(LOG_DEBUG,"socket %d wants to read.",conn->s);
if(
/* XXX does POLLHUP also mean it's definitely broken? */
@@ -300,7 +300,7 @@
conn = connection_array[i];
assert(conn);
if(conn->marked_for_close) {
- log(LOG_DEBUG,"check_conn_marked(): Cleaning up connection.");
+ log_fn(LOG_DEBUG,"Cleaning up connection.");
if(conn->s >= 0) { /* might be an incomplete exit connection */
/* FIXME there's got to be a better way to check for this -- and make other checks? */
connection_flush_buf(conn); /* flush it first */
Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- onion.c 14 Sep 2003 02:58:50 -0000 1.62
+++ onion.c 14 Sep 2003 08:17:14 -0000 1.63
@@ -59,6 +59,7 @@
}
circuit_t *onion_next_task(void) {
+ circuit_t *circ;
if(!ol_list)
return NULL; /* no onions pending, we're done */
@@ -71,7 +72,9 @@
}
assert(ol_length > 0);
- return ol_list->circ;
+ circ = ol_list->circ;
+ onion_pending_remove(ol_list->circ);
+ return circ;
}
/* go through ol_list, find the onion_queue_t element which points to
@@ -95,7 +98,7 @@
} else { /* we need to hunt through the rest of the list */
for( ;tmpo->next && tmpo->next->circ != circ; tmpo=tmpo->next) ;
if(!tmpo->next) {
- log(LOG_WARNING,"onion_pending_remove(): circ (p_aci %d), not in list!",circ->p_aci);
+ log_fn(LOG_DEBUG,"circ (p_aci %d) not in list, probably at cpuworker.",circ->p_aci);
return;
}
/* now we know tmpo->next->circ == circ */
More information about the tor-commits
mailing list