mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
defensive programming to catch duplicate calls to connection_init_or_handshake_state
This commit is contained in:
parent
f371816209
commit
ce703bd53e
@ -1583,6 +1583,10 @@ int
|
|||||||
connection_init_or_handshake_state(or_connection_t *conn, int started_here)
|
connection_init_or_handshake_state(or_connection_t *conn, int started_here)
|
||||||
{
|
{
|
||||||
or_handshake_state_t *s;
|
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 = conn->handshake_state = tor_malloc_zero(sizeof(or_handshake_state_t));
|
||||||
s->started_here = started_here ? 1 : 0;
|
s->started_here = started_here ? 1 : 0;
|
||||||
s->digest_sent_data = 1;
|
s->digest_sent_data = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user