aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-11-21 17:51:46 -0500
committerNick Mathewson <nickm@torproject.org>2011-12-22 09:51:59 -0500
commit847541ce5db48152576639d7adc0a6209b661be9 (patch)
treee5abf248461a52eb3cea79b1837bc4ea3100e8fc /src/or
parent0187bd872885343761174218529aed7058f8d636 (diff)
downloadtor-847541ce5db48152576639d7adc0a6209b661be9.tar
tor-847541ce5db48152576639d7adc0a6209b661be9.tar.gz
Log what fraction of EXTEND cells have died for being non-early
Diffstat (limited to 'src/or')
-rw-r--r--src/or/relay.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 60d439aca..fdc26006a 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1188,7 +1188,9 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
connection_mark_and_flush(TO_CONN(conn));
}
return 0;
- case RELAY_COMMAND_EXTEND:
+ case RELAY_COMMAND_EXTEND: {
+ static uint64_t total_n_extend=0, total_nonearly=0;
+ total_n_extend++;
if (conn) {
log_fn(LOG_PROTOCOL_WARN, domain,
"'extend' cell received for non-zero stream. Dropping.");
@@ -1200,10 +1202,15 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
RATELIM_INIT(EARLY_WARNING_INTERVAL);
char *m;
if (cell->command == CELL_RELAY) {
+ ++total_nonearly;
if ((m = rate_limit_log(&early_warning_limit, approx_time()))) {
/* XXXX make this a protocol_warn once we're happier with it*/
+ double percentage = ((double)total_nonearly)/total_n_extend;
+ percentage *= 100;
log_fn(LOG_WARN, domain, "EXTEND cell received, "
"but not via RELAY_EARLY. Dropping.%s", m);
+ log_fn(LOG_WARN, domain, " (We have dropped %.02f%% of all "
+ "EXTEND cells for this reason)", percentage);
tor_free(m);
}
} else {
@@ -1214,6 +1221,7 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0;
}
return circuit_extend(cell, circ);
+ }
case RELAY_COMMAND_EXTENDED:
if (!layer_hint) {
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,