From 459aada4d0e2ca1c4538fb6f4ef4e275ae162600 Mon Sep 17 00:00:00 2001 From: Andrea Shepard Date: Thu, 13 Jun 2013 20:32:31 -0700 Subject: Don't queue more cells as a middle relay than the spec allows to be in flight --- src/or/or.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/or/or.h') diff --git a/src/or/or.h b/src/or/or.h index daff6de933..fbf6f52c75 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -543,6 +543,8 @@ typedef enum { #define CIRCUIT_PURPOSE_IS_ESTABLISHED_REND(p) \ ((p) == CIRCUIT_PURPOSE_C_REND_JOINED || \ (p) == CIRCUIT_PURPOSE_S_REND_JOINED) +/** True iff the circuit_t c is actually an or_circuit_t */ +#define CIRCUIT_IS_ORCIRC(c) (((circuit_t *)(c))->magic == OR_CIRCUIT_MAGIC) /** How many circuits do we want simultaneously in-progress to handle * a given stream? */ @@ -820,6 +822,18 @@ typedef enum { /** Amount to increment a stream window when we get a stream SENDME. */ #define STREAMWINDOW_INCREMENT 50 +/** Maximum number of queued cells on a circuit for which we are the + * midpoint before we give up and kill it. This must be >= circwindow + * to avoid killing innocent circuits. The ORCIRC_MAX_MIDDLE_KILL_THRESH + * ratio controls the margin of error between emitting a warning and + * killing the circuit. + */ +#define ORCIRC_MAX_MIDDLE_CELLS CIRCWINDOW_START_MAX +/** Ratio of hard (circuit kill) to soft (warning) thresholds for the + * ORCIRC_MAX_MIDDLE_CELLS tests. + */ +#define ORCIRC_MAX_MIDDLE_KILL_THRESH (1.1f) + /* Cell commands. These values are defined in tor-spec.txt. */ #define CELL_PADDING 0 #define CELL_CREATE 1 @@ -3157,6 +3171,12 @@ typedef struct or_circuit_t { * exit-ward queues of this circuit; reset every time when writing * buffer stats to disk. */ uint64_t total_cell_waiting_time; + + /** Maximum cell queue size for a middle relay; this is stored per circuit + * so append_cell_to_circuit_queue() can adjust it if it changes. If set + * to zero, it is initialized to the default value. + */ + uint32_t max_middle_cells; } or_circuit_t; /** Convert a circuit subtype to a circuit_t. */ -- cgit v1.2.3-54-g00ecf From c9745822913e00a8664d68f62009fde231eff2aa Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 14 Jun 2013 01:40:35 -0400 Subject: Increase the limit so leaky pipe might work --- src/or/or.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/or/or.h') diff --git a/src/or/or.h b/src/or/or.h index fbf6f52c75..a0776f1de2 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -824,11 +824,12 @@ typedef enum { /** Maximum number of queued cells on a circuit for which we are the * midpoint before we give up and kill it. This must be >= circwindow - * to avoid killing innocent circuits. The ORCIRC_MAX_MIDDLE_KILL_THRESH + * to avoid killing innocent circuits, and >= circwindow*2 to give + * leaky-pipe a chance of working someday. The ORCIRC_MAX_MIDDLE_KILL_THRESH * ratio controls the margin of error between emitting a warning and * killing the circuit. */ -#define ORCIRC_MAX_MIDDLE_CELLS CIRCWINDOW_START_MAX +#define ORCIRC_MAX_MIDDLE_CELLS (CIRCWINDOW_START_MAX*2) /** Ratio of hard (circuit kill) to soft (warning) thresholds for the * ORCIRC_MAX_MIDDLE_CELLS tests. */ -- cgit v1.2.3-54-g00ecf