From 9fced56ef1a6eae0ce01de310c871823998bd791 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 10 Apr 2018 12:34:28 -0400 Subject: Refactor or_connection token buckets to use token_bucket_t --- src/or/or.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/or/or.h') diff --git a/src/or/or.h b/src/or/or.h index bcce33755d..a826cacbf3 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -80,6 +80,7 @@ #include "crypto_curve25519.h" #include "crypto_ed25519.h" #include "tor_queue.h" +#include "token_bucket.h" #include "util_format.h" #include "hs_circuitmap.h" @@ -1652,13 +1653,8 @@ typedef struct or_connection_t { time_t timestamp_lastempty; /**< When was the outbuf last completely empty?*/ - /* bandwidth* and *_bucket only used by ORs in OPEN state: */ - int bandwidthrate; /**< Bytes/s added to the bucket. (OPEN ORs only.) */ - int bandwidthburst; /**< Max bucket size for this conn. (OPEN ORs only.) */ - int read_bucket; /**< When this hits 0, stop receiving. Every second we - * add 'bandwidthrate' to this, capping it at - * bandwidthburst. (OPEN ORs only) */ - int write_bucket; /**< When this hits 0, stop writing. Like read_bucket. */ + token_bucket_t bucket; /**< Used for rate limiting when the connection is + * in state CONN_OPEN. */ /* * Count the number of bytes flushed out on this orconn, and the number of -- cgit v1.2.3-54-g00ecf