remove dead code

circuits no longer queue more cells when the windows are empty --
they simply don't package it from the buffer if they're not going to want it.

we can restore this code later if we need to resume queueing.


svn:r294
This commit is contained in:
Roger Dingledine 2003-05-20 06:53:10 +00:00
parent 39e9d79038
commit 1c6def292b
4 changed files with 1 additions and 109 deletions

View File

@ -228,36 +228,16 @@ int circuit_deliver_relay_cell_from_edge(cell_t *cell, circuit_t *circ,
cell_direction = CELL_DIRECTION_OUT;
numsent_ap++;
log(LOG_DEBUG,"circuit_deliver_relay_cell_from_edge(): now sent %d relay cells from ap", numsent_ap);
#if 0
if(layer_hint->package_window <= 0) {
log(LOG_DEBUG,"circuit_deliver_relay_cell_from_edge(): package_window 0, queueing for later.");
circ->relay_queue = relay_queue_add(circ->relay_queue, cell, layer_hint);
return 0;
}
layer_hint->package_window--;
// log(LOG_INFO,"circuit_deliver_relay_cell_from_edge(): package_window now %d.",layer_hint->package_window);
#endif
} else { /* i'm the exit */
cell_direction = CELL_DIRECTION_IN;
// assert(layer_hint == NULL);
// assert(circ->cpath == NULL);
numsent_exit++;
log(LOG_DEBUG,"circuit_deliver_relay_cell_from_edge(): now sent %d relay cells from exit", numsent_exit);
#if 0
if(circ->package_window <= 0) {
log(LOG_DEBUG,"circuit_deliver_relay_cell_from_edge(): package_window 0, queueing for later.");
circ->relay_queue = relay_queue_add(circ->relay_queue, cell, layer_hint);
return 0;
}
circ->package_window--;
#endif
}
if(circuit_deliver_relay_cell(cell, circ, cell_direction, layer_hint) < 0) {
return -1;
}
// circuit_consider_stop_edge_reading(circ, edge_type, layer_hint); /* has window reached 0? */
return 0;
}
@ -344,9 +324,8 @@ int relay_crypt(circuit_t *circ, char *in, int inlen, char cell_direction,
thishop = thishop->next;
} while(thishop != circ->cpath && thishop->state == CPATH_STATE_OPEN);
log(LOG_INFO,"relay_crypt(): in-cell at OP not recognized. Killing circuit.");
log(LOG_INFO,"relay_crypt(): in-cell at OP not recognized. Dropping.");
return 0;
// return -1;
} else { /* we're in the middle. Just one crypt. */
log(LOG_DEBUG,"relay_crypt(): before encrypt: %d",*(int*)(in+2));
@ -448,46 +427,6 @@ void circuit_resume_edge_reading(circuit_t *circ, int edge_type, crypt_path_t *l
assert(edge_type == EDGE_EXIT || edge_type == EDGE_AP);
log(LOG_DEBUG,"circuit_resume_edge_reading(): resuming");
#if 0
/* first, send the queue waiting at circ onto the circuit */
relay = circ->relay_queue;
while(relay) {
assert(relay->cell);
if(edge_type == EDGE_EXIT) {
assert(relay->layer_hint == NULL);
circ->package_window--;
assert(circ->package_window >= 0);
if(circuit_deliver_relay_cell(relay->cell, circ, CELL_DIRECTION_IN, relay->layer_hint) < 0) {
circuit_close(circ);
return;
}
} else { /* ap */
assert(relay->layer_hint);
if(relay->layer_hint != layer_hint) {
relay=relay->next; /* this cell isn't destined for this layer. don't send it. */
continue;
}
relay->layer_hint->package_window--;
assert(relay->layer_hint->package_window >= 0);
if(circuit_deliver_relay_cell(relay->cell, circ, CELL_DIRECTION_OUT, relay->layer_hint) < 0) {
circuit_close(circ);
return;
}
}
victim = relay;
relay=relay->next;
if(circ->relay_queue == victim) {
circ->relay_queue = relay;
}
free(victim->cell);
free(victim);
if(circuit_consider_stop_edge_reading(circ, edge_type, layer_hint))
return;
}
#endif
if(edge_type == EDGE_EXIT)
conn = circ->n_conn;

View File

@ -172,38 +172,6 @@ void command_process_relay_cell(cell_t *cell, connection_t *conn) {
return;
}
#if 0
if(cell->aci == circ->p_aci) { /* it's an outgoing cell */
if(--circ->p_receive_circwindow < 0) { /* is it less than 0 after decrement? */
log(LOG_INFO,"command_process_relay_cell(): Too many relay cells for out circuit (aci %d). Closing.", circ->p_aci);
circuit_close(circ);
return;
}
log(LOG_DEBUG,"command_process_relay_cell(): p_receive_circwindow for aci %d is %d.",circ->p_aci,circ->p_receive_circwindow);
}
if(cell->aci == circ->n_aci) { /* it's an ingoing cell */
if(--circ->n_receive_circwindow < 0) { /* is it less than 0 after decrement? */
log(LOG_INFO,"command_process_relay_cell(): Too many relay cells for in circuit (aci %d). Closing.", circ->n_aci);
circuit_close(circ);
return;
}
log(LOG_DEBUG,"command_process_relay_cell(): n_receive_circwindow for aci %d is %d.",circ->n_aci,circ->n_receive_circwindow);
}
#endif
#if 0
if(circ->state == CIRCUIT_STATE_ONION_WAIT) {
log(LOG_WARNING,"command_process_relay_cell(): circuit in onion_wait. Dropping relay cell.");
return;
}
if(circ->state == CIRCUIT_STATE_OR_WAIT) {
log(LOG_WARNING,"command_process_relay_cell(): circuit in or_wait. Dropping relay cell.");
return;
}
#endif
/* circ->p_conn and n_conn are only null if we're at an edge point with no connections yet */
if(cell->aci == circ->p_aci) { /* it's an outgoing cell */
cell->aci = circ->n_aci; /* switch it */
if(circuit_deliver_relay_cell(cell, circ, CELL_DIRECTION_OUT, conn->cpath_layer) < 0) {

View File

@ -80,7 +80,6 @@ void onion_pending_process_one(void) {
return; /* it died on us */
}
assert(ol_list->circ->p_conn);
assert(ol_length > 0);
circ = ol_list->circ;
@ -399,12 +398,6 @@ crypt_path_t *onion_generate_cpath(routerinfo_t **firsthop) {
}
cpath = hop;
#if 0
if (i) { /* not last hop. (last hop has 0's for these.) */
hop->port = rarray[route[i-1]]->or_port;
hop->addr = rarray[route[i-1]]->addr;
}
#endif
hop->port = rarray[route[i]]->or_port;
hop->addr = rarray[route[i]]->addr;

View File

@ -74,10 +74,6 @@
#define OP_CONN_STATE_AWAITING_KEYS 0
#define OP_CONN_STATE_OPEN 1
#if 0
#define OP_CONN_STATE_CLOSE 2 /* flushing the buffer, then will close */
#define OP_CONN_STATE_CLOSE_WAIT 3 /* have sent a destroy, awaiting a confirmation */
#endif
/* how to read these states:
* foo_CONN_STATE_bar_baz:
@ -260,10 +256,6 @@ struct connection_t {
struct crypt_path_t *cpath_layer; /* a pointer to which node in the circ this conn exits at */
int package_window;
int deliver_window;
#if 0
int n_receive_streamwindow;
int p_receive_streamwindow;
#endif
int done_sending;
int done_receiving;
#ifdef USE_ZLIB