aboutsummaryrefslogtreecommitdiff
path: root/crates/arti/src/reload_cfg.rs
Commit message (Collapse)AuthorAgeFilesLines
* arti: In RPC mode, remember normalized configuration dataNick Mathewson7 days1-9/+43
| | | | This will be the basis for configuration _inspection_.
* reload_cfg: add comments about some tricky points.Nick Mathewson7 days1-0/+9
|
* reload_cfg: Allow modules to be set after CfgMgr is createdNick Mathewson7 days1-10/+35
| | | | (But before the watcher task is launched.)
* code movement to tidy previous commitNick Mathewson7 days1-44/+41
|
* reload_cfg: Separate creation of CfgMgr and launch of taskNick Mathewson7 days1-6/+61
| | | | | | We want to be able to create the CfgMgr early so that we can give it to the RPC code, then add a bunch of reconfigurable modules to it, and only then launch the file-watcher task.
* Apply 1 suggestion(s) to 1 file(s)Nick Mathewson9 days1-1/+1
| | | Co-authored-by: gabi-250 <[email protected]>
* Reindent impl block.Nick Mathewson13 days1-87/+88
|
* Move reload_configuration method.Nick Mathewson13 days1-40/+37
| | | | Code movement only.
* reload_cfg: Refactor to use a CfgMgr object.Nick Mathewson13 days1-85/+132
| | | | | | | | | Right now this just helps us keep the parts of the configuration-reloading logic in one place, and clarifies what needs to be owned by the watcher thread and what doesn't. Moving forward, this will help make the configuration something that RPC can inspect and change.
* Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-151-3/+0
|
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* arti: rpc functionality to bootstrap a defer_bootstrapped client.Nick Mathewson2026-06-081-0/+8
|
* Option to defer bootstrapping at startup.Nick Mathewson2026-06-081-4/+60
| | | | | | This option will primarily be used by integrators who want to modify the configuration, either directly or via RPC, before launching Arti completely.
* arti::reload_cfg: Extract common part of select_biased! blockNick Mathewson2026-05-181-15/+3
|
* arti: Reformat reload_cfg.rs and cfg.rsNick Mathewson2026-05-181-62/+80
| | | | | | | | This is _just_ the results of a rustfmt invocation on this file. Due to #2532, these modules were getting overlooked by our regular rustfmt checks. I'm planning to circle back later on and fix #2532, but for now, reformatting these files will make future edits cleaner.
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-1/+7
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* all: replace all uses of `futures::task::SpawnExt` with `tor_rtcompat::SpawnExt`Steven Engler2025-11-041-1/+1
|
* arti: Ignore reload_cfg::test::watch_multiple.Wesley Aptekar-Cassels2025-10-161-0/+2
| | | | This is flaky, ignoring until #1607 is fixed.
* arti config: Fix flaky watch_single_file test in a more principled way.Wesley Aptekar-Cassels2025-10-071-12/+4
| | | | Thanks to gabi for the suggestion.
* arti config: Fix flaky watch_single_file test.Wesley Aptekar-Cassels2025-10-071-2/+12
| | | | Fixes: #1607
* *: suppress cognitive_complexity warnings from nightlyNick Mathewson2025-05-291-0/+2
| | | | | | | | | | | | | Apparently clippy nightly is better (or worse?) about detecting complex functions than before, so I'm suppressing these warnings where they occur. I have mixed feelings about these warnings: On the plus side, they really do help to detect functions that are twistier than they need to be. On the minus side, they get confused by tracing macros, and the "allows" do pile up. But on the plus side, those "allows" do provide a way to find functions that need to be refactored, and they are never uglier than the functions they decorate.
* arti: Disable RPC reconfiguration for nowNick Mathewson2024-12-191-0/+4
|
* tor-config: Document the limitations of the FileWatcher.Gabriela Moldovan2024-10-161-0/+2
|
* arti: Temporarily disable a flaky test.Ian Jackson2024-09-051-0/+1
| | | | | | | | This effectively reverts 71e3d52f5aeb34ca7bca80053079a8c7505b99ac, which was itself a revert of disabling this test the first time. Sadly it still doesn't seem to be reliable. We have agreed on IRC to disable it for now.
* Merge branch 'slow-test' into 'main'Ian Jackson2024-09-051-2/+15
|\ | | | | | | | | | | | | arti: Make the config watcher debounce interval configurable. Closes #1589 See merge request tpo/core/arti!2387
| * arti: Make the config watcher debounce interval configurable (fmt).Gabriela Moldovan2024-09-041-1/+9
| |
| * arti: Make the config watcher debounce interval configurable.Gabriela Moldovan2024-09-041-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Previously, the `reload_cfg::test::watch_multiple` test would take about 3s to run. This test modifies 3 files and waits for the corresponding `reconfigure()` events to fire. Because of the `sleep(DEBOUNCE_INTERVAL)` in `run_watcher`, it would wind up waiting for about 1s for each of them. This makes the event debouncing optional, and disables it in the tests. Closes #1589
* | Revert "arti: Temporarily disable a flaky test."Gabriela Moldovan2024-08-291-1/+0
| | | | | | | | This reverts commit ececf6be2eaffc201666cd3413dc19c025be66de.
* | arti: Write the test config atomically.Gabriela Moldovan2024-08-291-1/+4
|/ | | | | | | | | | | | The flakiness from the `watch_single_file` test was caused by the race between the config write, and the fake SIGHUP "signal" sent on `sighup_tx`: sometimes, the sighup would get handled between creating the config file and writing its contents. In those cases, the config received in `TestModule::reconfigure` would be `Default::default()`, which caused an assertion to fail (because the test is expecting to receive the `ArtiConfig` it wrote to disk). Closes #1549
* tor-config: Rename watch_file to watch_path.Gabriela Moldovan2024-08-271-1/+1
| | | | `FileWatcher::watch_file` can be used with arbitrary paths.
* arti: Temporarily disable a flaky test.Gabriela Moldovan2024-08-221-0/+1
| | | | Disabling until #1549 is fixed to unblock CI.
* arti: Use a postage::watch channel in the tests.Gabriela Moldovan2024-08-221-15/+22
| | | | | | | | The watch channel should help prevent flakiness in the tests (`TestModule` uses `maybe_send` to only send the received config if it's different from the previously received value. This is supposed to prevent the tests from failing when duplicate update events are received).
* arti: Add test for config reloading.Gabriela Moldovan2024-08-211-0/+174
|
* arti: Wrap long lines not handled by rustfmt.Gabriela Moldovan2024-08-211-2/+14
|
* tor-config: Support watching dirs for files with a given extension.Gabriela Moldovan2024-08-211-1/+1
| | | | | | | | | | | | | | This also fixes a couple of issues with the previous implementation: * it enables you to watch for more than just one file/extension per directory (each directory now has a list of filters. If any of the filters apply to the path contained in the notify::Event, the `FilterWatcher` notifies the listeners * it removes the list watched files from `FileWatcher`. This makes things a lot simpler to grok: essentially, the file watcher only ever watches directories, notifying if an "interesting" file was changed (in our case, the interesting files are files that have a relevant extension, such as `.auth`, or specific configuration files, as specified by `ConfigurationSources`).
* tor-config: Make FileWatcher use an opaque channel type.Gabriela Moldovan2024-08-211-89/+106
| | | | The `FileWatcher` now uses a `postage::watch` channel under the hood.
* tor-config: Give FileWatcherBuilder a handle to the runtime.Gabriela Moldovan2024-08-211-5/+6
| | | | | The event handler will soon be made async, so we need a handle to the runtime.
* tor-config: Move FileWatcher to tor-config.Gabriela Moldovan2024-08-211-185/+22
| | | | | | | | | For the most part, this is just code motion. The only change here is that `prepare` is no longer a method on `FileWatcher`. This decouples `FileWatcher` from `ConfigurationSources`, enabling us to use it to watch files and directories that aren't configuration.
* arti: Update outdated FileWatcher docs.Gabriela Moldovan2024-08-211-5/+1
| | | | | The `FileWatcher` doesn't contain the channel for receiving events anymore, and `FileWatcher::event_matched` was removed at some point.
* tor-config: Allow ConfigurationSource to be verbatim text.Nick Mathewson2024-03-131-0/+1
| | | | | This will let us test our configuration logic without having to use the `config` crate directly.
* arti config watch: Pass Runtime as first argumentIan Jackson2024-03-041-2/+2
| | | | That seems often how we do things elsewhere.
* arti config watch: Pass a Runtime, not a TorClientIan Jackson2024-03-041-2/+2
| | | | | | | | | | | | I found this confusing in !2009, where the variable is unused on Windows: I wondered if this meant our config-reloading only worked on Unix, since "obviously it would need the TorClient". But actually the TorClient was only used *in this argument* for its runtime. The actual reconfiguration of the TorClient is doen by it being in one of the ReconfigurableModule's. Change the type of the argument for clarity.
* arti: do not warn about unused variable on WindowsTobias Stoeckmann2024-02-291-0/+1
| | | | | Do not complain on non-unix systems that variable client is not used. It is only accessed within the function on unix systems.
* arti: Only exit if all the modules have been dropped.Gabriela Moldovan2024-01-251-7/+8
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1917#note_2988815
* arti: Use Weak references for the reconfigurable modules.Gabriela Moldovan2024-01-251-4/+12
| | | | | | | | | | | | | | | Previously, the `ProxySet` (and all the other `reconfigurable_modules`) were kept alive by the `watch_for_config_changes` background thread, which was preventing them from being dropped when `run()` exited. IOW, onion services never received the shutdown signal. Now `watch_for_config_changes` takes `Weak` references, and the only strong references to the modules are kept in the `reconfigurable_modules` local variable in `run()`, which is dropped when `run()` exits (e.g. on SIGINT). This allows onion services to execute their shutdown logic on CTRL-C. Part of #1244
* arti: Generalize a TODO HSS about reconfiguration.Nick Mathewson2023-12-121-0/+8
| | | | | | It's correct that we'd like someday for the `arti` crate APIs to allow all the different modes supported by `Reconfigure` enum; this is #1156, and it does not block an HSS release.
* arti: Make reconfiguration slightly more abstractNick Mathewson2023-12-051-23/+81
| | | | | | | | | | Now instead of having a hardwired list of of things to reconfigure, the watch_cfg module now has a vector of ReconfigurableModule. As noted in the documentation, I don't intend that this should be our final API here: It is deliberately not exposed. When we revisit the structure of `arti` more, we should probably do this differently.
* Add cognitive-complexity exceptions for clippy.Nick Mathewson2023-09-051-0/+2
| | | | I have no idea why these became necessary.
* Throughout: Use *_report!() macros for reporting Errors.Nick Mathewson2023-07-071-0/+2
| | | | | | | | | | | | | | | I identified the cases to replace by searching for the string `.report()`. There are a few that I didn't change: * A couple of cases that used anyhow::Error, * One case that reported two Errors. * Two cases in `tor_hsclient::err` that just did `error!("Bug: {}")`. I have also not audited the cases in `tor-hsclient` where we're using `tor_error::Report` manually. Nonetheless, closes #949.