[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] remove dead code
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home/arma/work/onion/cvs/src/or
Modified Files:
circuit.c command.c onion.c or.h
Log Message:
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.
Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- circuit.c 20 May 2003 06:41:22 -0000 1.44
+++ circuit.c 20 May 2003 06:53:10 -0000 1.45
@@ -228,36 +228,16 @@
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 @@
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 @@
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;
Index: command.c
===================================================================
RCS file: /home/or/cvsroot/src/or/command.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- command.c 20 May 2003 06:41:22 -0000 1.30
+++ command.c 20 May 2003 06:53:10 -0000 1.31
@@ -172,38 +172,6 @@
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) {
Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- onion.c 20 May 2003 06:41:22 -0000 1.48
+++ onion.c 20 May 2003 06:53:10 -0000 1.49
@@ -80,7 +80,6 @@
return; /* it died on us */
}
- assert(ol_list->circ->p_conn);
assert(ol_length > 0);
circ = ol_list->circ;
@@ -399,12 +398,6 @@
}
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;
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- or.h 20 May 2003 06:41:23 -0000 1.85
+++ or.h 20 May 2003 06:53:10 -0000 1.86
@@ -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 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