diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-10 12:34:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-13 10:41:14 -0400 |
commit | 9fced56ef1a6eae0ce01de310c871823998bd791 (patch) | |
tree | e361226027bc9275a5d2158a8a08fbfccc3c8b3a /src/or/or.h | |
parent | 8a852397462e39cfbc21e3cea20ddd39be40598d (diff) | |
download | tor-9fced56ef1a6eae0ce01de310c871823998bd791.tar.gz tor-9fced56ef1a6eae0ce01de310c871823998bd791.zip |
Refactor or_connection token buckets to use token_bucket_t
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 10 |
1 files changed, 3 insertions, 7 deletions
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 |