aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-03-01 01:15:01 +0000
committerNick Mathewson <nickm@torproject.org>2005-03-01 01:15:01 +0000
commitb7b05dc1b26c5d828cda618f2a27fa883b7bfb7e (patch)
tree50682b08ab20ed297190c92a149b1a5ab9963e93 /src/or/connection.c
parent349ee1abea59083b14bddf1470afe9d25d22b43c (diff)
downloadtor-b7b05dc1b26c5d828cda618f2a27fa883b7bfb7e.tar
tor-b7b05dc1b26c5d828cda618f2a27fa883b7bfb7e.tar.gz
make control interface stream IDs monotonically increasing to prevent possible races
svn:r3715
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index c76cc4562..f44185ac2 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -110,6 +110,7 @@ static int connection_bucket_read_limit(connection_t *conn);
* Initialize conn's timestamps to now.
*/
connection_t *connection_new(int type) {
+ static uint32_t n_connections_allocated = 0;
connection_t *conn;
time_t now = time(NULL);
@@ -117,6 +118,7 @@ connection_t *connection_new(int type) {
conn->magic = CONNECTION_MAGIC;
conn->s = -1; /* give it a default of 'not used' */
conn->poll_index = -1; /* also default to 'not used' */
+ conn->global_identifier = n_connections_allocated++;
conn->type = type;
if (!connection_is_listener(conn)) { /* listeners never use their buf */