aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-05-05 23:24:46 +0000
committerRoger Dingledine <arma@torproject.org>2003-05-05 23:24:46 +0000
commitd7f50337c14ca42d991e44ab203b1c34591b3eb3 (patch)
tree246aae88a138b167453ba223efe86238f8ee75ce /src/or/connection_edge.c
parent44b4efe34d4f6bd6a39703c065a075cb9ddb4656 (diff)
downloadtor-d7f50337c14ca42d991e44ab203b1c34591b3eb3.tar
tor-d7f50337c14ca42d991e44ab203b1c34591b3eb3.tar.gz
incremental path building in; uses ephemeral DH; onions are gone
still need to change circuit-level sendmes svn:r264
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 1f0039137..bae7ae8d0 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -23,7 +23,7 @@ int connection_edge_process_inbuf(connection_t *conn) {
circ = circuit_get_by_conn(conn);
if (!circ)
return -1;
-
+
memset(&cell, 0, sizeof(cell_t));
cell.command = CELL_RELAY;
cell.length = RELAY_HEADER_SIZE;
@@ -123,13 +123,12 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
if(edge_type == EDGE_AP) {
log(LOG_INFO,"connection_edge_process_relay_cell(): relay begin request unsupported. Dropping.");
return 0;
- } else {
- if(conn) {
- log(LOG_INFO,"connection_edge_process_relay_cell(): begin cell for known stream. Dropping.");
- return 0;
- }
- return connection_exit_begin_conn(cell, circ);
}
+ if(conn) {
+ log(LOG_INFO,"connection_edge_process_relay_cell(): begin cell for known stream. Dropping.");
+ return 0;
+ }
+ return connection_exit_begin_conn(cell, circ);
case RELAY_COMMAND_DATA:
if(!conn) {
log(LOG_DEBUG,"connection_edge_process_relay_cell(): relay cell dropped, unknown stream %d.",*(int*)conn->stream_id);
@@ -166,14 +165,6 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
}
log(LOG_DEBUG,"connection_edge_process_relay_cell(): end cell for stream %d. Removing stream.",*(int*)conn->stream_id);
- /* go through and identify who points to conn. remove conn from the list. */
-#if 0
- if(conn == circ->p_conn) {
- circ->p_conn = conn->next_stream;
- }
- for(prevconn = circ->p_conn; prevconn->next_stream != conn; prevconn = prevconn->next_stream) ;
- prevconn->next_stream = conn->next_stream;
-#endif
#ifdef HALF_OPEN
conn->done_sending = 1;
shutdown(conn->s, 1); /* XXX check return; refactor NM */
@@ -182,6 +173,23 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
#endif
conn->marked_for_close = 1;
break;
+ case RELAY_COMMAND_EXTEND:
+ if(conn) {
+ log(LOG_INFO,"connection_edge_process_relay_cell(): 'extend' for non-zero stream. Dropping.");
+ return 0;
+ }
+ return circuit_extend(cell, circ);
+ case RELAY_COMMAND_EXTENDED:
+ if(edge_type == EDGE_EXIT) {
+ log(LOG_INFO,"connection_edge_process_relay_cell(): 'extended' unsupported at exit. Dropping.");
+ return 0;
+ }
+ log(LOG_DEBUG,"connection_edge_process_relay_cell(): Got an extended cell! Yay.");
+ if(circuit_finish_handshake(circ, cell->payload+RELAY_HEADER_SIZE) < 0) {
+ log(LOG_INFO,"connection_edge_process_relay_cell(): circuit_finish_handshake failed.");
+ return -1;
+ }
+ return circuit_send_next_onion_skin(circ);
case RELAY_COMMAND_CONNECTED:
if(edge_type == EDGE_EXIT) {
log(LOG_INFO,"connection_edge_process_relay_cell(): 'connected' unsupported at exit. Dropping.");