mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
track how many in-flight hs-side rend circs
not used in decision-making yet, but it's all ready to use in a "don't dequeue any more if we have too many in-flight" kind of way
This commit is contained in:
parent
5e768d5cb9
commit
b95bd5017f
@ -689,6 +689,27 @@ trim_rend_pqueue(hs_pow_service_state_t *pow_state, time_t now)
|
|||||||
smartlist_free(old_pqueue);
|
smartlist_free(old_pqueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Count up how many pending outgoing (CIRCUIT_PURPOSE_S_CONNECT_REND)
|
||||||
|
* circuits there are for this service. Used in the PoW rate limiting
|
||||||
|
* world to decide whether it's time to launch any new ones.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
count_service_rp_circuits_pending(hs_service_t *service)
|
||||||
|
{
|
||||||
|
origin_circuit_t *ocirc = NULL;
|
||||||
|
int count = 0;
|
||||||
|
while ((ocirc = circuit_get_next_by_purpose(ocirc,
|
||||||
|
CIRCUIT_PURPOSE_S_CONNECT_REND))) {
|
||||||
|
/* Count up circuits that are v3 and for this service. */
|
||||||
|
if (ocirc->hs_ident != NULL &&
|
||||||
|
ed25519_pubkey_eq(ô->hs_ident->identity_pk,
|
||||||
|
&service->keys.identity_pk)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
/** How many rendezvous request we handle per mainloop event. Per prop327,
|
/** How many rendezvous request we handle per mainloop event. Per prop327,
|
||||||
* handling an INTRODUCE2 cell takes on average 5.56msec on an average CPU and
|
* handling an INTRODUCE2 cell takes on average 5.56msec on an average CPU and
|
||||||
* so it means that launching this max amount of circuits is well below 0.08
|
* so it means that launching this max amount of circuits is well below 0.08
|
||||||
@ -705,6 +726,11 @@ handle_rend_pqueue_cb(mainloop_event_t *ev, void *arg)
|
|||||||
|
|
||||||
(void) ev; /* Not using the returned event, make compiler happy. */
|
(void) ev; /* Not using the returned event, make compiler happy. */
|
||||||
|
|
||||||
|
log_notice(LD_REND, "Considering launching more rendezvous responses. "
|
||||||
|
"%d in-flight, %d pending.",
|
||||||
|
count_service_rp_circuits_pending(service),
|
||||||
|
smartlist_len(pow_state->rend_request_pqueue));
|
||||||
|
|
||||||
/* Process rendezvous request until the maximum per mainloop run. */
|
/* Process rendezvous request until the maximum per mainloop run. */
|
||||||
while (smartlist_len(pow_state->rend_request_pqueue) > 0) {
|
while (smartlist_len(pow_state->rend_request_pqueue) > 0) {
|
||||||
/* Pop next request by effort. */
|
/* Pop next request by effort. */
|
||||||
|
Loading…
Reference in New Issue
Block a user