|
@@ -63,6 +63,7 @@
|
|
|
#include "core/or/circuituse.h"
|
|
|
#include "core/or/circuitstats.h"
|
|
|
#include "core/or/circuitpadding.h"
|
|
|
+#include "core/or/crypt_path.h"
|
|
|
#include "core/mainloop/connection.h"
|
|
|
#include "app/config/config.h"
|
|
|
#include "core/or/connection_edge.h"
|
|
@@ -2785,59 +2786,6 @@ circuits_handle_oom(size_t current_allocation)
|
|
|
n_dirconns_killed);
|
|
|
}
|
|
|
|
|
|
-/** Verify that cpath layer <b>cp</b> has all of its invariants
|
|
|
- * correct. Trigger an assert if anything is invalid.
|
|
|
- */
|
|
|
-void
|
|
|
-assert_cpath_layer_ok(const crypt_path_t *cp)
|
|
|
-{
|
|
|
-// tor_assert(cp->addr); /* these are zero for rendezvous extra-hops */
|
|
|
-// tor_assert(cp->port);
|
|
|
- tor_assert(cp);
|
|
|
- tor_assert(cp->magic == CRYPT_PATH_MAGIC);
|
|
|
- switch (cp->state)
|
|
|
- {
|
|
|
- case CPATH_STATE_OPEN:
|
|
|
- relay_crypto_assert_ok(&cp->crypto);
|
|
|
- /* fall through */
|
|
|
- case CPATH_STATE_CLOSED:
|
|
|
- /*XXXX Assert that there's no handshake_state either. */
|
|
|
- tor_assert(!cp->rend_dh_handshake_state);
|
|
|
- break;
|
|
|
- case CPATH_STATE_AWAITING_KEYS:
|
|
|
- /* tor_assert(cp->dh_handshake_state); */
|
|
|
- break;
|
|
|
- default:
|
|
|
- log_fn(LOG_ERR, LD_BUG, "Unexpected state %d", cp->state);
|
|
|
- tor_assert(0);
|
|
|
- }
|
|
|
- tor_assert(cp->package_window >= 0);
|
|
|
- tor_assert(cp->deliver_window >= 0);
|
|
|
-}
|
|
|
-
|
|
|
-/** Verify that cpath <b>cp</b> has all of its invariants
|
|
|
- * correct. Trigger an assert if anything is invalid.
|
|
|
- */
|
|
|
-static void
|
|
|
-assert_cpath_ok(const crypt_path_t *cp)
|
|
|
-{
|
|
|
- const crypt_path_t *start = cp;
|
|
|
-
|
|
|
- do {
|
|
|
- assert_cpath_layer_ok(cp);
|
|
|
- /* layers must be in sequence of: "open* awaiting? closed*" */
|
|
|
- if (cp != start) {
|
|
|
- if (cp->state == CPATH_STATE_AWAITING_KEYS) {
|
|
|
- tor_assert(cp->prev->state == CPATH_STATE_OPEN);
|
|
|
- } else if (cp->state == CPATH_STATE_OPEN) {
|
|
|
- tor_assert(cp->prev->state == CPATH_STATE_OPEN);
|
|
|
- }
|
|
|
- }
|
|
|
- cp = cp->next;
|
|
|
- tor_assert(cp);
|
|
|
- } while (cp != start);
|
|
|
-}
|
|
|
-
|
|
|
/** Verify that circuit <b>c</b> has all of its invariants
|
|
|
* correct. Trigger an assert if anything is invalid.
|
|
|
*/
|