mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
bugfix: onion pending queue now works
and fixed recent memory leak svn:r456
This commit is contained in:
parent
b63013e847
commit
ebc23f690c
@ -383,7 +383,7 @@ int relay_check_recognized(circuit_t *circ, int cell_direction, char *stream, co
|
||||
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 @@ int circuit_finish_handshake(circuit_t *circ, char *reply) {
|
||||
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);
|
||||
|
@ -349,6 +349,8 @@ static int connection_tls_finish_handshake(connection_t *conn) {
|
||||
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 */
|
||||
|
@ -102,13 +102,13 @@ int connection_edge_send_command(connection_t *fromconn, circuit_t *circ, int re
|
||||
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 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
|
||||
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 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
|
||||
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;
|
||||
|
@ -256,7 +256,7 @@ static void conn_read(int i) {
|
||||
* 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 @@ static void check_conn_marked(int i) {
|
||||
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 */
|
||||
|
@ -59,6 +59,7 @@ int onion_pending_add(circuit_t *circ) {
|
||||
}
|
||||
|
||||
circuit_t *onion_next_task(void) {
|
||||
circuit_t *circ;
|
||||
|
||||
if(!ol_list)
|
||||
return NULL; /* no onions pending, we're done */
|
||||
@ -71,7 +72,9 @@ circuit_t *onion_next_task(void) {
|
||||
}
|
||||
|
||||
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 @@ void onion_pending_remove(circuit_t *circ) {
|
||||
} 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 */
|
||||
|
Loading…
Reference in New Issue
Block a user