mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Diagnostic warning to see if it's pending destroys causing 11553
This commit is contained in:
parent
bd169aa9a5
commit
47a0c10728
@ -88,7 +88,8 @@ static circid_t
|
|||||||
get_unique_circ_id_by_chan(channel_t *chan)
|
get_unique_circ_id_by_chan(channel_t *chan)
|
||||||
{
|
{
|
||||||
#define MAX_CIRCID_ATTEMPTS 64
|
#define MAX_CIRCID_ATTEMPTS 64
|
||||||
|
int in_use;
|
||||||
|
unsigned n_with_circ = 0, n_pending_destroy = 0;
|
||||||
circid_t test_circ_id;
|
circid_t test_circ_id;
|
||||||
circid_t attempts=0;
|
circid_t attempts=0;
|
||||||
circid_t high_bit, max_range, mask;
|
circid_t high_bit, max_range, mask;
|
||||||
@ -126,9 +127,12 @@ get_unique_circ_id_by_chan(channel_t *chan)
|
|||||||
chan->warned_circ_ids_exhausted = 1;
|
chan->warned_circ_ids_exhausted = 1;
|
||||||
log_warn(LD_CIRC,"No unused circIDs found on channel %s wide "
|
log_warn(LD_CIRC,"No unused circIDs found on channel %s wide "
|
||||||
"circID support, with %u inbound and %u outbound circuits. "
|
"circID support, with %u inbound and %u outbound circuits. "
|
||||||
|
"Found %u circuit IDs in use by circuits, and %u with "
|
||||||
|
"pending destroy cells."
|
||||||
"Failing a circuit.",
|
"Failing a circuit.",
|
||||||
chan->wide_circ_ids ? "with" : "without",
|
chan->wide_circ_ids ? "with" : "without",
|
||||||
chan->num_p_circuits, chan->num_n_circuits);
|
chan->num_p_circuits, chan->num_n_circuits,
|
||||||
|
n_with_circ, n_pending_destroy);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -136,7 +140,13 @@ get_unique_circ_id_by_chan(channel_t *chan)
|
|||||||
crypto_rand((char*) &test_circ_id, sizeof(test_circ_id));
|
crypto_rand((char*) &test_circ_id, sizeof(test_circ_id));
|
||||||
test_circ_id &= mask;
|
test_circ_id &= mask;
|
||||||
test_circ_id |= high_bit;
|
test_circ_id |= high_bit;
|
||||||
} while (circuit_id_in_use_on_channel(test_circ_id, chan));
|
|
||||||
|
in_use = circuit_id_in_use_on_channel(test_circ_id, chan);
|
||||||
|
if (in_use == 1)
|
||||||
|
++n_with_circ;
|
||||||
|
else if (in_use == 2)
|
||||||
|
++n_pending_destroy;
|
||||||
|
} while (in_use);
|
||||||
return test_circ_id;
|
return test_circ_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1065,13 +1065,21 @@ circuit_get_by_circid_channel_even_if_marked(circid_t circ_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Return true iff the circuit ID <b>circ_id</b> is currently used by a
|
/** Return true iff the circuit ID <b>circ_id</b> is currently used by a
|
||||||
* circuit, marked or not, on <b>chan</b>. */
|
* circuit, marked or not, on <b>chan</b>, or if the circ ID is reserved until
|
||||||
|
* a queued destroy cell can be sent.
|
||||||
|
*
|
||||||
|
* (Return 1 if the circuit is present, marked or not; Return 2
|
||||||
|
* if the circuit ID is pending a destroy.)
|
||||||
|
**/
|
||||||
int
|
int
|
||||||
circuit_id_in_use_on_channel(circid_t circ_id, channel_t *chan)
|
circuit_id_in_use_on_channel(circid_t circ_id, channel_t *chan)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
return circuit_get_by_circid_channel_impl(circ_id, chan, &found) != NULL
|
if (circuit_get_by_circid_channel_impl(circ_id, chan, &found) != NULL)
|
||||||
|| found;
|
return 1;
|
||||||
|
if (found)
|
||||||
|
return 2;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the circuit that a given edge connection is using. */
|
/** Return the circuit that a given edge connection is using. */
|
||||||
|
Loading…
Reference in New Issue
Block a user