tor_assert(conn->base_.type == CONN_TYPE_EXT_OR);
conn->base_.type = CONN_TYPE_OR;
+ TO_CONN(conn)->state = 0; // set the state to a neutral value
control_event_or_conn_status(conn, OR_CONN_EVENT_NEW, 0);
connection_tls_start_handshake(conn, 1);
}
/* record the address */
tor_addr_copy(&conn->addr, &addr);
conn->port = port;
+ if (conn->address) {
+ tor_free(conn->address);
+ }
+ conn->address = tor_dup_addr(&addr);
return 0;
}
tt_int_op(is_reading,==,1);
tt_int_op(handshake_start_called,==,1);
tt_int_op(TO_CONN(conn)->type, ==, CONN_TYPE_OR);
- /* XXXXX the state is now nonsensical! It should be set to something
- * neutral (zero?) before we connection_or_change_state; right now
- * it's EXT_OR_CONN_STATE_FLUSHING */
- /* tt_int_op(TO_CONN(conn)->state, ==, 0); XXXX */
+ tt_int_op(TO_CONN(conn)->state, ==, 0);
done:
UNMOCK(connection_write_to_buf_impl_);