summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-06-17 18:49:55 +0000
committerNick Mathewson <nickm@torproject.org>2005-06-17 18:49:55 +0000
commitf9f09f1c5e69fcbd9a1c840c1b86854dfee3af6a (patch)
treebe08d99134fa5d6e5c61db0eea34a479ba7db470 /src/or/connection.c
parent946892ab68bfeab4aa503d673adaa8374f778c55 (diff)
downloadtor-f9f09f1c5e69fcbd9a1c840c1b86854dfee3af6a.tar.gz
tor-f9f09f1c5e69fcbd9a1c840c1b86854dfee3af6a.zip
Start implementing framework for revised control spec.
svn:r4447
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 71b9dfe106..06464c9e84 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -120,8 +120,12 @@ conn_state_to_string(int type, int state)
break;
case CONN_TYPE_CONTROL:
switch (state) {
- case CONTROL_CONN_STATE_OPEN: return "open";
- case CONTROL_CONN_STATE_NEEDAUTH: return "waiting for authentication";
+ case CONTROL_CONN_STATE_OPEN_V0: return "open (protocol v0)";
+ case CONTROL_CONN_STATE_OPEN_V1: return "open (protocol v1)";
+ case CONTROL_CONN_STATE_NEEDAUTH_V0:
+ return "waiting for authentication (protocol unknown)";
+ case CONTROL_CONN_STATE_NEEDAUTH_V1:
+ return "waiting for authentication (protocol v1)";
}
break;
}
@@ -667,7 +671,7 @@ connection_init_accepted_conn(connection_t *conn)
conn->state = DIR_CONN_STATE_SERVER_COMMAND_WAIT;
break;
case CONN_TYPE_CONTROL:
- conn->state = CONTROL_CONN_STATE_NEEDAUTH;
+ conn->state = CONTROL_CONN_STATE_NEEDAUTH_V0;
break;
}
return 0;
@@ -1578,7 +1582,9 @@ connection_state_is_open(connection_t *conn)
if ((conn->type == CONN_TYPE_OR && conn->state == OR_CONN_STATE_OPEN) ||
(conn->type == CONN_TYPE_AP && conn->state == AP_CONN_STATE_OPEN) ||
(conn->type == CONN_TYPE_EXIT && conn->state == EXIT_CONN_STATE_OPEN) ||
- (conn->type == CONN_TYPE_CONTROL && conn->state ==CONTROL_CONN_STATE_OPEN))
+ (conn->type == CONN_TYPE_CONTROL &&
+ (conn->state == CONTROL_CONN_STATE_OPEN_V0 ||
+ conn->state == CONTROL_CONN_STATE_OPEN_V1)))
return 1;
return 0;