diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-10-30 21:46:02 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-10-30 21:46:02 +0000 |
commit | 7e80640b97bbd97e8bcf5e95366f535a8bd16bfc (patch) | |
tree | f46817f2cd202427069438dda5340d61de2ac6e7 /src/or/connection_or.c | |
parent | 57f7c852f809b9332fc7a52058a24713b1385c14 (diff) | |
download | tor-7e80640b97bbd97e8bcf5e95366f535a8bd16bfc.tar.gz tor-7e80640b97bbd97e8bcf5e95366f535a8bd16bfc.zip |
r16285@catbus: nickm | 2007-10-30 17:43:25 -0400
Implement (but do not enable) link connection version negotiation
svn:r12286
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r-- | src/or/connection_or.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 1d083e39b3..89e3200b85 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -16,6 +16,7 @@ const char connection_or_c_id[] = static int connection_tls_finish_handshake(or_connection_t *conn); static int connection_or_process_cells_from_inbuf(or_connection_t *conn); +static int connection_or_send_versions(or_connection_t *conn); /**************************************************************/ @@ -732,8 +733,25 @@ connection_tls_finish_handshake(or_connection_t *conn) } directory_set_dirty(); + + if (tor_tls_used_v1_handshake(conn->tls)) { + conn->link_proto = 1; + return connection_or_set_state_open(conn); + } else { + /*XXXX020 actually, we'll need to send some kind of authentication. */ + conn->_base.state = OR_CONN_STATE_WAITING_FOR_VERSIONS; + return connection_or_send_versions(conn); + } +} + +/**DOCDOC*/ +int +connection_or_set_state_open(or_connection_t *conn) +{ + int started_here = connection_or_nonopen_was_started_here(conn); conn->_base.state = OR_CONN_STATE_OPEN; control_event_or_conn_status(conn, OR_CONN_EVENT_CONNECTED, 0); + if (started_here) { rep_hist_note_connect_succeeded(conn->identity_digest, time(NULL)); if (entry_guard_register_connect_status(conn->identity_digest, 1, @@ -746,7 +764,6 @@ connection_tls_finish_handshake(or_connection_t *conn) connection_watch_events(TO_CONN(conn), EV_READ); circuit_n_conn_done(conn, 1); /* send the pending creates, if any. */ - conn->link_proto = 1; /* Version negotiation not yet enabled.XXX020 */ return 0; } @@ -850,10 +867,12 @@ connection_or_send_versions(or_connection_t *conn) } connection_or_write_cell_to_buf(&cell, conn); + + return 0; } /** DOCDOC */ -static int +int connection_or_send_netinfo(or_connection_t *conn) { cell_t cell; @@ -881,7 +900,5 @@ connection_or_send_netinfo(or_connection_t *conn) connection_or_write_cell_to_buf(&cell, conn); - /*XXXX020 remove these once we send netinfo and versions cells. */ - (void) connection_or_send_netinfo; - (void) connection_or_send_versions; + return 0; } |