summaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-13 10:47:24 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-13 10:47:24 -0400
commitb152d62cee7480ee7b9b68dd9b619db65b6cd112 (patch)
treeff89d131f60906f9d1b8e06af77883b3d1155769 /src/or/or.h
parentad57b1279ab68e204243ddf3cf841fd85606c331 (diff)
parent787bafc0f916c143ac244a217accf755817512df (diff)
downloadtor-b152d62cee7480ee7b9b68dd9b619db65b6cd112.tar.gz
tor-b152d62cee7480ee7b9b68dd9b619db65b6cd112.zip
Merge branch 'token_bucket_refactor_squashed'
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/or/or.h b/src/or/or.h
index b845443947..829b6755d2 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"
@@ -1660,20 +1661,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. */
-
- /** Last emptied read token bucket in msec since midnight; only used if
- * TB_EMPTY events are enabled. */
- uint32_t read_emptied_time;
- /** Last emptied write token bucket in msec since midnight; only used if
- * TB_EMPTY events are enabled. */
- uint32_t write_emptied_time;
+ 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
@@ -4431,9 +4420,6 @@ typedef struct {
/** Enable CELL_STATS events. Only altered on testing networks. */
int TestingEnableCellStatsEvent;
- /** Enable TB_EMPTY events. Only altered on testing networks. */
- int TestingEnableTbEmptyEvent;
-
/** If true, and we have GeoIP data, and we're a bridge, keep a per-country
* count of how many client addresses have contacted us so that we can help
* the bridge authority guess which countries have blocked access to us. */