Skip to content

Commit 10af401

Browse files
dignifiedquireFrandoArqu
authored
refactor(iroh): add --start option to CLI commands (#1802)
## Description Changes to CLI commands: * All RPC commands now have a `--start` option that starts a node, runs the command, and then shuts down the node * `iroh get` is now `iroh blob get`, and needs `--start` flag to run standalone * `iroh start SOURCE` is now `iroh start --add SOURCE` * Improvements to the node startup code and error handling ## Notes and open questions We could remove the `--add SOURCE` option from `iroh start` if there was a way to to keep running the node after starting it with a command. Could also be something like an `--exec` option. But let's leave that to a followup. --------- Co-authored-by: Franz Heinzmann (Frando) <[email protected]> Co-authored-by: Asmir Avdicevic <[email protected]>
1 parent f661467 commit 10af401

File tree

16 files changed

+1127
-1303
lines changed

16 files changed

+1127
-1303
lines changed

iroh-bytes/src/provider.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! The server side API
22
use std::fmt::Debug;
3+
use std::path::PathBuf;
34
use std::sync::Arc;
45
use std::time::Duration;
56

@@ -209,7 +210,7 @@ pub enum DownloadProgress {
209210
/// The size of the entry in bytes.
210211
size: u64,
211212
/// The path to the file where the data is exported.
212-
target: String,
213+
target: PathBuf,
213214
},
214215
/// We have made progress exporting the data.
215216
///

iroh-net/src/netcheck/reportgen.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -741,18 +741,19 @@ async fn run_probe(
741741
debug!("starting probe");
742742

743743
let (would_help_tx, would_help_rx) = oneshot::channel();
744-
reportstate
744+
if let Err(err) = reportstate
745745
.send(Message::ProbeWouldHelp(
746746
probe.clone(),
747747
derp_node.clone(),
748748
would_help_tx,
749749
))
750750
.await
751-
.map_err(|err| {
752-
error!("Failed to check if probe would help: {err:#}");
753-
err
754-
})
755-
.map_err(|err| ProbeError::AbortSet(err.into(), probe.clone()))?;
751+
{
752+
// this happens on shutdown or if the report is already finished
753+
debug!("Failed to check if probe would help: {err:#}");
754+
return Err(ProbeError::AbortSet(err.into(), probe.clone()));
755+
}
756+
756757
if !would_help_rx.await.map_err(|_| {
757758
ProbeError::AbortSet(
758759
anyhow!("ReportCheck actor dropped sender while waiting for ProbeWouldHelp response"),

0 commit comments

Comments
 (0)