Nick Mathewson
0b40ed5e70
Start re-refactoring the token bucket interface.
...
Begin by creating a lowest-level triple of the types needed to
implement a token bucket: a configuration, a timestamp, and the raw
bucket itself.
Note that for low-level buckets, the units of the timestamp and the
bucket itself are unspecified: each user can use a different type.
(This patch breaks check-spaces; a later patch will fix it)
2018-04-13 16:31:47 -04:00
Nick Mathewson
03b96882de
Rename token_bucket_t to token_bucket_rw_t.
...
This is a simple search-and-replace to rename the token bucket type
to indicate that it contains both a read and a write bucket, bundled
with their configuration. It's preliminary to refactoring the
bucket type.
2018-04-13 10:54:26 -04:00
Nick Mathewson
b152d62cee
Merge branch 'token_bucket_refactor_squashed'
2018-04-13 10:47:24 -04:00
Nick Mathewson
ad57b1279a
Disable load_geoip_file() tests on windows
...
See bug #25787 for discussion; we should have a better fix here.
2018-04-13 10:42:19 -04:00
Nick Mathewson
787bafc0f9
Increase tolerances for imprecise time.
2018-04-13 10:41:15 -04:00
Nick Mathewson
3f514fe3b1
Accept small hops backward in the monotonic timer.
2018-04-13 10:41:15 -04:00
Nick Mathewson
c63761a0a6
changes file for token_bucket refactoring
2018-04-13 10:41:14 -04:00
Nick Mathewson
12f58f2f87
Remove a bunch of int casts; make clang happier.
2018-04-13 10:41:14 -04:00
Nick Mathewson
6be994fa71
Ensure that global buckets are updated on configuration change
2018-04-13 10:41:14 -04:00
Nick Mathewson
a38fd9bc5b
Replace the global buckets with token_bucket_t
2018-04-13 10:41:14 -04:00
Nick Mathewson
9fced56ef1
Refactor or_connection token buckets to use token_bucket_t
2018-04-13 10:41:14 -04:00
Nick Mathewson
8a85239746
Add a helper function to decrement read and write at the same time
2018-04-13 10:41:14 -04:00
Nick Mathewson
c376200f6a
Add a new token-bucket backend abstraction, with tests
...
This differs from our previous token bucket abstraction in a few
ways:
1) It is an abstraction, and not a collection of fields.
2) It is meant to be used with monotonic timestamps, which should
produce better results than calling gettimeofday over and over.
2018-04-13 10:41:14 -04:00
Nick Mathewson
d8ef9a2d1e
Expose a function that computes stamp units from msec.
...
(It turns out we can't just expose STAMP_TICKS_PER_SECOND, since
Apple doesn't have that.)
2018-04-13 10:41:08 -04:00
Nick Mathewson
d3b9b5a3dd
Remove windows log_from_handle as unused.
...
This function was only used by PortForwardingHelper, which was
removed in 9df110cd72
. Its presence caused warnings on windows.
2018-04-12 12:38:46 -04:00
Nick Mathewson
f0887e30dd
Merge branch 'maint-0.3.3'
2018-04-12 12:31:41 -04:00
Nick Mathewson
46795a7be6
Attempt to fix 32-bit clang builds, which broke with 31508a0abc
...
When size_t is 32 bits, the unit tests can't fit anything more than
4GB-1 into a size_t.
Additionally, tt_int_op() uses "long" -- we need tt_u64_op() to
safely test uint64_t values for equality.
Bug caused by tests for #24782 fix; not in any released Tor.
2018-04-12 12:30:36 -04:00
Nick Mathewson
467c882baa
Merge branch 'maint-0.3.3'
2018-04-12 12:25:51 -04:00
Nick Mathewson
4aaa4215e7
Attempt to fix 32-bit builds, which broke with 31508a0abc
...
When size_t is 32 bits, doing "size_t ram; if (ram > 8GB) { ... }"
produces a compile-time warning.
Bug caused by #24782 fix; not in any released Tor.
2018-04-12 12:25:09 -04:00
Nick Mathewson
037fb0c804
Merge branch 'maint-0.3.3'
2018-04-12 11:14:42 -04:00
Alexander Færøy
31508a0abc
Use less memory for MaxMemInQueues for machines with more than 8 GB of RAM.
...
This patch changes the algorithm of compute_real_max_mem_in_queues() to
use 0.4 * RAM iff the system has more than or equal to 8 GB of RAM, but
will continue to use the old value of 0.75 * RAM if the system have less
than * GB of RAM available.
This patch also adds tests for compute_real_max_mem_in_queues().
See: https://bugs.torproject.org/24782
2018-04-12 11:14:16 -04:00
Alexander Færøy
5633a63379
Use STATIC for compute_real_max_mem_in_queues
...
This patch makes compute_real_max_mem_in_queues use the STATIC macro,
which allows us to test the function.
See: https://bugs.torproject.org/24782
2018-04-12 10:51:48 -04:00
Alexander Færøy
bd42367a1e
Make get_total_system_memory mockable.
...
This patch makes get_total_system_memory mockable, which allows us to
alter the return value of the function in tests.
See: https://bugs.torproject.org/24782
2018-04-12 10:51:45 -04:00
Nick Mathewson
a51630cc9a
Merge branch 'maint-0.3.3'
2018-04-11 15:38:00 -04:00
Nick Mathewson
0803d79f55
Merge branch 'bug25581_033_v2_asn_squashed' into maint-0.3.3
2018-04-11 15:37:56 -04:00
Nick Mathewson
8b8630a501
Rename HSLayer{2,3}Nodes to start without an underscore.
...
The old single-underscore names remain as a deprecated synonym.
Fixes bug 25581; bugfix on 0.3.3.1-alpha.
2018-04-11 15:37:49 -04:00
Nick Mathewson
0c8f901ee7
Merge branch 'maint-0.3.3'
2018-04-11 10:48:46 -04:00
Mike Perry
f9ba0c6546
Bug 24989: Count client hsdir gets towards MaxClientCircuitsPending.
...
We removed this by breaking them out from general in #13837 .
2018-04-11 10:47:06 -04:00
Nick Mathewson
6bdfaa8b24
Merge remote-tracking branch 'isis-github/bug25425_squashed2'
2018-04-10 15:32:26 -04:00
Nick Mathewson
6e467a7a34
Merge remote-tracking branch 'isis-github/bug25409'
2018-04-10 15:27:09 -04:00
Isis Lovecruft
4178642bf8
changes: Add changes file for 25425.
2018-04-10 19:26:46 +00:00
Isis Lovecruft
550037f677
changes: Add changes file for 25409.
2018-04-10 19:21:10 +00:00
Isis Lovecruft
65d6b66e99
config: Obsolete PortForwarding and PortForwardingHelper options.
...
* FIXES part of #25409 : https://bugs.torproject.org/25409
2018-04-10 19:08:59 +00:00
Nick Mathewson
0b1a054d68
Merge branch 'maint-0.3.2' into maint-0.3.3
2018-04-10 14:26:32 -04:00
Nick Mathewson
ef16a11b90
Merge branch 'maint-0.3.3'
2018-04-10 14:26:32 -04:00
Nick Mathewson
d3ac47b415
Merge branch 'maint-0.3.1' into maint-0.3.2
2018-04-10 14:26:32 -04:00
Nick Mathewson
db6902c235
Merge branch 'maint-0.2.9' into maint-0.3.1
2018-04-10 14:26:29 -04:00
Nick Mathewson
10a1969ca3
Merge remote-tracking branch 'ahf-github/bugs/24854_029_2' into maint-0.2.9
2018-04-10 14:25:57 -04:00
Nick Mathewson
16f08de0fd
Remove TestingEnableTbEmptyEvent
...
This option was used for shadow testing previously, but is no longer
used for anything. It interferes with refactoring our token buckets.
2018-04-10 12:16:21 -04:00
Isis Lovecruft
3ee7a8d3a5
tests: Make tt_finished() macro for tests without tt_*_op() calls.
2018-04-09 19:32:47 +00:00
Isis Lovecruft
c2c5b13e5d
test: Add testing module and some unittests for bridges.c.
...
This roughly doubles our test coverage of the bridges.c module.
* ADD new testing module, .../src/test/test_bridges.c.
* CHANGE a few function declarations from `static` to `STATIC`.
* CHANGE one function in transports.c, transport_get_by_name(), to be
mockable.
* CLOSES #25425 : https://bugs.torproject.org/25425
2018-04-09 19:32:46 +00:00
David Goulet
395fa0258d
compat: Fix unchecked return value from event_del()
...
Explicitly tell the compiler we don't care about it.
Coverity CID 1434156
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-09 14:12:45 -04:00
Nick Mathewson
e58555135a
Add a comment explaining why we do a certain redundant check
...
Closes ticket 25291.
2018-04-09 12:58:17 -04:00
Alexander Færøy
1295044dc8
Lift the list of default directory servers into their own file.
...
This patch lifts the list of default directory authorities from config.c
into their own auth_dirs.inc file, which is then included in config.c
using the C preprocessor.
Patch by beastr0.
See: https://bugs.torproject.org/24854
2018-04-09 16:00:26 +02:00
Nick Mathewson
2fac948158
Include tor_log rust files in source distribution.
...
Fixes another case of #25732 ; bug not in any released Tor.
2018-04-06 16:19:14 -04:00
Nick Mathewson
fb2fe41f6f
Merge branch 'maint-0.3.3'
2018-04-06 16:18:47 -04:00
Nick Mathewson
306563ac68
Ship all files needed to build Tor with rust
...
Fixes bug 25732; bugfix on 0.3.3.2-alpha when strings.rs was
introduced.
2018-04-06 16:18:11 -04:00
Nick Mathewson
98b694bfd5
Merge branch 'isolate_libevent_2_squashed'
2018-04-06 08:50:35 -04:00
Roger Dingledine
0b0e4886cf
fix confusing comment
...
presumably introduced by copy-and-paste mistake
2018-04-05 15:59:37 -04:00
Nick Mathewson
421c2310a8
changes file for libevent isolation work
2018-04-05 12:36:28 -04:00