aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/onion_queue.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2021-03-09 15:39:03 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2021-03-17 18:22:38 +0200
commitf493a12e897b02f2e347078dc3e2a2437c324b66 (patch)
treee3e9ca242526b71090ad255d1dcd182b875e8f2d /src/feature/relay/onion_queue.c
parent0a5ecb334298187a64f58382231245111130aa76 (diff)
downloadtor-f493a12e897b02f2e347078dc3e2a2437c324b66.tar.gz
tor-f493a12e897b02f2e347078dc3e2a2437c324b66.zip
Implement straightforward overload general metrics.
- OOM metric - onionskin overload metric - DNS timeout metric
Diffstat (limited to 'src/feature/relay/onion_queue.c')
-rw-r--r--src/feature/relay/onion_queue.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/feature/relay/onion_queue.c b/src/feature/relay/onion_queue.c
index 3cbaa65d28..eaf7608fac 100644
--- a/src/feature/relay/onion_queue.c
+++ b/src/feature/relay/onion_queue.c
@@ -33,6 +33,7 @@
#include "core/or/circuitlist.h"
#include "core/or/onion.h"
#include "feature/nodelist/networkstatus.h"
+#include "feature/stats/rephist.h"
#include "core/or/or_circuit_st.h"
@@ -163,15 +164,19 @@ onion_pending_add(or_circuit_t *circ, create_cell_t *onionskin)
#define WARN_TOO_MANY_CIRC_CREATIONS_INTERVAL (60)
static ratelim_t last_warned =
RATELIM_INIT(WARN_TOO_MANY_CIRC_CREATIONS_INTERVAL);
- char *m;
- if (onionskin->handshake_type == ONION_HANDSHAKE_TYPE_NTOR &&
- (m = rate_limit_log(&last_warned, approx_time()))) {
- log_warn(LD_GENERAL,
- "Your computer is too slow to handle this many circuit "
- "creation requests! Please consider using the "
- "MaxAdvertisedBandwidth config option or choosing a more "
- "restricted exit policy.%s",m);
- tor_free(m);
+ if (onionskin->handshake_type == ONION_HANDSHAKE_TYPE_NTOR) {
+ char *m;
+ /* Note this ntor onionskin drop as an overload */
+ rep_hist_note_overload(OVERLOAD_GENERAL);
+ if ((m = rate_limit_log(&last_warned, approx_time()))) {
+ log_warn(LD_GENERAL,
+ "Your computer is too slow to handle this many circuit "
+ "creation requests! Please consider using the "
+ "MaxAdvertisedBandwidth config option or choosing a more "
+ "restricted exit policy.%s",
+ m);
+ tor_free(m);
+ }
}
tor_free(tmp);
return -1;