summaryrefslogtreecommitdiff
path: root/crates/arti/src/reload_cfg.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Corrected the order of imports in order to make the 'rust-checks' job ↵Andy2023-06-231-1/+1
| | | | complete successfully.
* Provided a fix for #831 - 'Unused import' warnings on WindowsAndy2023-06-231-3/+4
|
* Use tor_error::Report for remaining errors in error! in artiIan Jackson2023-01-301-1/+1
|
* Use ErrorReport/Report for errors in warn! in artiIan Jackson2023-01-301-1/+1
|
* debounce reload cfg eventstrinity-1686a2022-11-011-0/+7
|
* rename unused fieldtrinity-1686a2022-10-301-3/+2
|
* update some stringstrinity-1686a2022-10-301-10/+10
|
* use iife so we can try! instead of custom error handlingtrinity-1686a2022-10-301-64/+56
|
* refactor so events always indicate reloadtrinity-1686a2022-10-301-71/+74
|
* depends less on notify typestrinity-1686a2022-10-301-22/+35
|
* update to v5.0.0trinity-1686a2022-08-311-23/+28
|
* small refactoring to reduce duplicaiton of config reloadingtrinity-1686a2022-08-271-0/+330