-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(iroh): do not remove the rpc lockfile if an iroh node is already …
…running (#2013) ## Description Previously, we were running `RpcStatus::clear`, every time we ran the `iroh start` command (`start::run_with_command`). This meant that even when we correctly exited the `iroh start` command in with the error "iroh is already running", we would then remove the rpc lock file, even though iroh was still running in a different process. Any subsequent calls to `iroh console` or any other iroh commands that expected an iroh node to be running, would assume that a node was *no longer running* because the rpc lock file was gone. This PR adds a new concrete `AlreadyRunningError` that we return from `start_node`. Before we run `RpcStatus::clear`, we check for the `AlreadyRunningError`, and do not clear the lockfile if that error is present. closes #2002 ## Notes & open questions **One big change in this PR** Using the `iroh_data_root` function makes it impossible to test anything at the `iroh::start` level, because the `IROH_DATA_DIR` env var makes sure that nothing can be tested in isolation. Setting the `env var` in one test, clobbers setting it in another. I have a commit that adjusts the code to: - run `iroh_data_dir()` once in `main.rs` - cascades the `iroh_data_dir` down through the code from there - remove any other references to calling `iroh_data_dir` anywhere else This mostly effects `commands::console` and `commands::start` ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [x] Tests if relevant.
- Loading branch information
Showing
7 changed files
with
182 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.