diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-10-26 20:19:25 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-01-11 11:10:17 -0500 |
commit | ce703bd53edec2ee123dd747d6cc975a259c68f9 (patch) | |
tree | 5f6ce2b23c233eb149f99920859558e01375e9aa /src/or/connection_or.c | |
parent | f37181620951d2e7a13f1363386563115d628761 (diff) | |
download | tor-ce703bd53edec2ee123dd747d6cc975a259c68f9.tar.gz tor-ce703bd53edec2ee123dd747d6cc975a259c68f9.zip |
defensive programming to catch duplicate calls to connection_init_or_handshake_state
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r-- | src/or/connection_or.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 7609138e68..76402a557b 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -1583,6 +1583,10 @@ int connection_init_or_handshake_state(or_connection_t *conn, int started_here) { or_handshake_state_t *s; + if (conn->handshake_state) { + log_warn(LD_BUG, "Duplicate call to connection_init_or_handshake_state!"); + return 0; + } s = conn->handshake_state = tor_malloc_zero(sizeof(or_handshake_state_t)); s->started_here = started_here ? 1 : 0; s->digest_sent_data = 1; |