|
@@ -674,9 +674,13 @@ safe_or_conn_open_cb(event_label_t label, event_data_t data, void *context)
|
|
|
tor_assert(label == or_conn_open_ev);
|
|
|
tor_assert(safe_or_conn != NULL);
|
|
|
tor_mutex_acquire(&TO_SAFE_CONN(safe_or_conn)->lock);
|
|
|
- tor_assert(safe_or_conn->state == SAFE_OR_CONN_STATE_LINK_HANDSHAKING);
|
|
|
+ tor_assert(safe_or_conn->state == SAFE_OR_CONN_STATE_LINK_HANDSHAKING ||
|
|
|
+ safe_or_conn->state == SAFE_OR_CONN_STATE_CLOSED);
|
|
|
|
|
|
- safe_or_connection_update_state(safe_or_conn, SAFE_OR_CONN_STATE_OPEN);
|
|
|
+ if (safe_or_conn->state != SAFE_OR_CONN_STATE_CLOSED) {
|
|
|
+ // if we're already closed, then just ignore it
|
|
|
+ safe_or_connection_update_state(safe_or_conn, SAFE_OR_CONN_STATE_OPEN);
|
|
|
+ }
|
|
|
|
|
|
tor_mutex_release(&TO_SAFE_CONN(safe_or_conn)->lock);
|
|
|
}
|