Ian Jackson
93a150229a
sqlite cache: Document reasoning about timestamps
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/831#note_2851764
2022-11-08 13:00:51 +00:00
Ian Jackson
5b66a5e199
bridge desc tests: Test caching and if-modified-since
2022-11-04 19:08:32 +00:00
Ian Jackson
78f7916a88
bridge desc tests: Break out queues_are_empty helper
2022-11-04 19:08:32 +00:00
Ian Jackson
40c21b7d19
bridge desc tests: Provide a sqlite connection
...
The current test case doesn't use this.
2022-11-04 19:08:32 +00:00
Ian Jackson
636bff3193
bridge desc: Implement storage functions at the DB layer
2022-11-04 19:08:32 +00:00
Ian Jackson
6bb2eb9902
bridge desc: Make Downloaded be Debug
2022-11-04 19:08:32 +00:00
Ian Jackson
5bc1d40a2b
bridge desc: Implement cache reuse logic and if-modified-since
...
This introduces the new API functions to Store.
But currently they are all no-ops.
So all this machinery doesn't actually do anything.
Also, it changes the API to the mockable downloader, to allow it to
support if-modified-since. So this isn't used either. But it is more
convenient to do this all at once in BridgeDescManager, since care
needs to be taken about the intraction between if-modified-since and
the persistent cache.
2022-11-04 19:08:32 +00:00
Ian Jackson
279a169031
bridge desc: Rename one more variable to text
2022-11-04 19:02:23 +00:00
Ian Jackson
eaaa61a8e2
bridge desc: Catch panics in the download functionality
2022-11-04 19:02:23 +00:00
Ian Jackson
3f3f27193c
bridge desc: Provide a Store to the bridge desc manager
...
We use the one in the dirmgr. That means that our constructor now has
to take a dirmgr. And, the dirmgr must have a circmgr.
This is all rather odd, TBH.
Add .. to the binding of the return values from setup, as
future-proofing.
The tests now need to provide a Store too. Make the sqlite::new_empty
function pub(crate) so we can use it.
We must retain the _db_tmp_dir, since when it goes away the tmp
directory is deleted and the db goes readonly.
2022-11-04 19:02:23 +00:00
Ian Jackson
1fa9dd62b3
bridge desc tests: Apply tracing_test::traced_test
...
This lets us see the log messages. They look fine, as it happens.
2022-11-04 19:02:23 +00:00
Ian Jackson
9424b0970d
tor-dirmgr: impl AsRef<dyn Error> for Error
...
This allows use with tor_error::Report.
2022-11-04 19:01:24 +00:00
Ian Jackson
f3957a50b6
tor-netdoc: RouterDesc: Add published accessor
...
The bridge descriptor manager is going to want this.
2022-11-04 19:01:24 +00:00
Ian Jackson
dcdd8053b4
dirmgr: Make store be in an Arc
...
This will let us share it with the bridge descriptor manager.
(As discussed with Nick.)
2022-11-04 19:01:24 +00:00
Ian Jackson
9a285ec4ad
dirmgr sqlite store: Improve schema updates
...
* Centralise applying the schema updates, in a closure
* Make the schema update SQL texts be in an array so we can loop
* Make the version update statement generic, not cloned-and-hacked
This will make it possible to add another schema version without
error-prone conditions etc.
2022-11-04 19:01:24 +00:00
Nick Mathewson
1be9019def
Merge branch 'store-yak-bd' into 'main'
...
bridgedesc: yaks for persistent storage
See merge request tpo/core/arti!827
2022-11-04 16:56:28 +00:00
Ian Jackson
bf563f3bdf
bridgedesc: Rename "text" from "output"
...
This was confusing, because it's the output of the donwload, but
nowhere near the output of the whole process. And it's going to
become even less so.
2022-11-03 19:00:47 +00:00
Ian Jackson
17ceae724e
bridgedesc: Make process_document into a free function
...
It deserves this treatment, I think.
2022-11-03 18:59:50 +00:00
Ian Jackson
c7a7ce5c20
bridgedesc: Introduce Downloaded
...
This gives names to things and makes things clearer, and this will be
even more true in a moemnt.
2022-11-03 18:59:50 +00:00
Ian Jackson
d2b31f7796
bridgedesc: download: Break out process_document
...
We're going to want to reuse this for handling cached stuff.
2022-11-03 18:57:40 +00:00
Ian Jackson
6fbf3059cd
bridgedesc: Prepare Mockable trait for if-modified-since
2022-11-03 18:57:40 +00:00
Nick Mathewson
7d079ade3b
Merge branch 'warning' into 'main'
...
tor-guardmgr: use imported WeightThreshold in one place
See merge request tpo/core/arti!825
2022-11-03 16:25:37 +00:00
Nick Mathewson
f0c8e239d6
Merge branch 'guardmgr-config' into 'main'
...
guardmgr: bridges config plumbing
See merge request tpo/core/arti!826
2022-11-03 16:23:51 +00:00
Ian Jackson
53905f3e1a
docs features: Add a suppression for testing
2022-11-03 15:51:45 +00:00
Ian Jackson
7d6f5d5eab
guardmgr config: Provide bridge information to new and reconfigure
2022-11-03 15:48:07 +00:00
Ian Jackson
aa375e2e09
tor-guardmgr: use imported WeightThreshold in one place
...
Without this, an unused import warning is generated when building
without features.
2022-11-03 15:44:32 +00:00
Ian Jackson
5bc3934fb4
bridges config: Provide uninhabited placeholder
...
This will avoid having to make bridge-related trait features in
GuardMgr conditional, which would be non-additive.
2022-11-03 15:43:41 +00:00
Ian Jackson
3dde9f8a05
bridges config: Check that bridges aren't enabled with no bridges
...
This is the validation which is called for by the documentation.
2022-11-03 15:43:41 +00:00
Ian Jackson
6c64be06a6
guardmgr config: Introduce and require new GuardMgrConfig trait
...
It doesn't seem to me like it makes sense to provide the backward
compatibility here.
2022-11-03 15:43:41 +00:00
Ian Jackson
f50da3efa1
define_accessor_trait: Allow specification of other items
2022-11-03 15:43:41 +00:00
Ian Jackson
64de9f74be
define_accessor_trait: Allow specification of supertraits
2022-11-03 15:43:41 +00:00
Ian Jackson
2bfce54959
guardmgr config: Pass fallback list from config by reference
...
This does involve additional cloning. However, soon it will mean that
we can pass the whole `TorClientConfig` by reference.
2022-11-03 15:43:41 +00:00
eta
37aa8e79d1
Merge branch '587_suppress' into 'main'
...
Suppress new clippy warnings in 1.65
Closes #587
See merge request tpo/core/arti!824
2022-11-03 15:38:19 +00:00
Nick Mathewson
1179c39859
Suppress two clippy::large_enum_variant warnings
...
These are newly present on 1.65. We can address them later.
2022-11-03 11:09:51 -04:00
Nick Mathewson
932fe48eaf
Run add_warnings.
2022-11-03 11:06:02 -04:00
Nick Mathewson
e4ca2459db
add_warnings: ignore clippy::result_large_err
...
This is a temporary workaround for #587 until we get it fixed for
real.
2022-11-03 11:05:14 -04:00
Nick Mathewson
0cb886a098
add_warnings: work with more non-GNU finds.
...
We were doing `find -name '*.rs'`, but `find . -name '*.rs'` (with the .)
is more standard.
2022-11-03 11:03:43 -04:00
eta
c77cecd5b3
Merge branch 'edition-2021' into 'main'
...
set all crate edition to 2021
See merge request tpo/core/arti!822
2022-11-03 14:39:24 +00:00
Ian Jackson
6b76c31011
Merge branch 'descriptors' into 'main'
...
Provide an implementation of BridgeDescProvider
See merge request tpo/core/arti!820
2022-11-03 12:15:07 +00:00
Ian Jackson
70b420adf8
bridge descriptors tests: Fix flaky test
2022-11-03 11:46:20 +00:00
Ian Jackson
daf7eac60a
bridge descriptors tests: Test set_bridges more thoroughly (fix)
...
The RetryDelays are being triggered for the 2nd time here, so their
timeouts can be longer. We must bump the sleep to make sure we don't
have a flaky test.
2022-11-03 11:37:30 +00:00
Ian Jackson
7a99601721
bridge descriptors: logging: Log addition and removal (fmt)
...
Worsify formatting as demanded by rustfmt.
2022-11-03 11:37:30 +00:00
Ian Jackson
269808336e
bridge descriptors: logging: Log addition and removal
...
This involves breaking the calls to `new_bridges.remove` into a helper
that does the logging.
2022-11-03 11:37:30 +00:00
Ian Jackson
17c766fde4
bridge descriptors: logging: Log download start and outcome
2022-11-03 11:37:30 +00:00
Ian Jackson
1ccd9db9af
bridge descriptors tests: Test set_bridges more thoroughly
...
Prior to the previous commit, set_bridges would malfunction if there
were bridges which where (i) in current (ii) in queued or running
(iii) in the new bridge set.
This test failed then and passes now.
2022-11-03 11:37:30 +00:00
Ian Jackson
4a830e1ac2
bridge descriptors: Rewrite set_bridges
...
This was fundamentally confused and irregular. Now it is more
regular: it does the same things to all the elements of Tracked,
and a simple filtering on current.
This fixes a bug, for which I'm about to add a test case.
2022-11-03 11:37:30 +00:00
Ian Jackson
0571674a64
bridge descriptors tests: Add another couple of test cases
2022-11-03 11:37:30 +00:00
Ian Jackson
6db3403820
bridge descriptors tests: stream_drain_ready returns event count
...
We'll use this in a moment.
2022-11-03 11:37:30 +00:00
Ian Jackson
53c1cf0c6d
bridge descriptors tests: Break out bad_bridge helper function
2022-11-03 11:37:30 +00:00
Ian Jackson
42b1b08fdf
bridge descriptors: Change default max_refetch
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/820#note_2850269
2022-11-03 11:37:30 +00:00