diff options
Diffstat (limited to 'src/transport/mycelium')
| -rw-r--r-- | src/transport/mycelium/daemon.rs | 17 | ||||
| -rw-r--r-- | src/transport/mycelium/mod.rs | 18 |
2 files changed, 14 insertions, 21 deletions
diff --git a/src/transport/mycelium/daemon.rs b/src/transport/mycelium/daemon.rs index f986d52..58ebe0c 100644 --- a/src/transport/mycelium/daemon.rs +++ b/src/transport/mycelium/daemon.rs @@ -66,19 +66,14 @@ impl MyceliumSetup { pub(crate) async fn bootstrap(config: MyceliumSpawnConfig) -> Result<Self> { // TODO warn for all ignored options if rest_url_opt is set if let Some(url) = config.rest_url_opt { - tracing::info!( - "Configured to interface with an external standalone Mycelium instance at: {}", - url - ); + tracing::info!(url = %url, "Using a daemon running elsewhere"); return Ok(Self { runtime: MyceliumRuntime::External, rest_url: url, }); } - tracing::info!( - "Configured to initialize an embedded user-space Mycelium background worker" - ); + tracing::info!("Starting the supervised daemon"); let key = match config.key_file_opt { Some(key_file) => KeySource::Path(key_file), @@ -101,7 +96,7 @@ impl MyceliumSetup { let supervised_node = SupervisedMycelium::spawn(key, private_net_config, config.tcp_port, &config.peers) .await - .context("Failed to securely bootstrap embedded Mycelium background worker")?; + .context("Starting the supervised Mycelium daemon")?; let resolved_url = Url::parse(&format!( "http://127.0.0.1:{}", @@ -204,7 +199,7 @@ impl SupervisedMycelium { } // Own process group: a Ctrl-C in the terminal goes to continuum only, // which then stops Mycelium itself, instead of both exiting at once (which - // shows up as "Mycelium runtime process exited"). + // shows up as "A transport stopped"). if libc::setpgid(0, 0) != 0 { return Err(std::io::Error::last_os_error()); } @@ -252,9 +247,7 @@ impl SupervisedMycelium { cmd.stdout(Stdio::piped()); cmd.stderr(Stdio::piped()); - let mut child = cmd - .spawn() - .context("Failed to execute mycelium process daemon")?; + let mut child = cmd.spawn().context("Running `mycelium`")?; // Its output goes where ours does. if let Some(mut stdout) = child.stdout.take() { diff --git a/src/transport/mycelium/mod.rs b/src/transport/mycelium/mod.rs index 43d14a8..61aab85 100644 --- a/src/transport/mycelium/mod.rs +++ b/src/transport/mycelium/mod.rs @@ -144,11 +144,11 @@ impl MyceliumTransport { Ok(response) if response.status() == StatusCode::NO_CONTENT => break, Ok(response) if response.status().is_success() => discarded += 1, Ok(response) => { - tracing::warn!(status = %response.status(), "Couldn't drain the Mycelium inbox"); + tracing::warn!(status = %response.status(), "Couldn't drain the inbox"); break; } Err(error) => { - tracing::warn!(error = %error, "Couldn't drain the Mycelium inbox"); + tracing::warn!(error = %error, "Couldn't drain the inbox"); break; } } @@ -274,7 +274,7 @@ impl Transport for MyceliumTransport { let mut other_versions = std::collections::HashSet::new(); tracing::info!( endpoint = self.messages_endpoint.as_str(), - "Starting Mycelium message consumer" + "Starting the consumer" ); // Several polls at once, so one message's HTTP round trip overlaps the next one's @@ -351,7 +351,7 @@ async fn poll_inbox( tx: tokio::sync::mpsc::Sender<InboundMessage>, ) { loop { - tracing::trace!("Polling Mycelium inbox"); + tracing::trace!("Polling the inbox"); let response = match client .get(endpoint.clone()) @@ -362,7 +362,7 @@ async fn poll_inbox( { Ok(resp) => resp, Err(error) => { - tracing::warn!(error = %error, "Mycelium inbox poll failed"); + tracing::warn!(error = %error, "Polling the inbox failed"); tokio::time::sleep(Duration::from_millis(250)).await; continue; } @@ -371,13 +371,13 @@ async fn poll_inbox( let status = response.status(); if status == StatusCode::NO_CONTENT { - tracing::trace!("Mycelium inbox is empty"); + tracing::trace!("The inbox is empty"); tokio::time::sleep(EMPTY_QUEUE_DELAY).await; continue; } if !status.is_success() { - tracing::warn!(status = %status, "Mycelium inbox returned unsuccessful HTTP status"); + tracing::warn!(status = %status, "Polling the inbox failed"); tokio::time::sleep(Duration::from_millis(500)).await; continue; } @@ -392,7 +392,7 @@ async fn poll_inbox( continue; } Err(error) => { - tracing::warn!(error = %error, "Failed to read raw Mycelium response stream"); + tracing::warn!(error = %error, "Couldn't read a message from the inbox"); tokio::time::sleep(Duration::from_millis(100)).await; continue; } @@ -404,7 +404,7 @@ async fn poll_inbox( tracing::error!( error = %error, raw_payload = %String::from_utf8_lossy(&raw_bytes), - "Failed to decode inbound Mycelium message structure" + "Dropping a message that doesn't decode" ); tokio::time::sleep(Duration::from_millis(500)).await; continue; |
