Skip to content

Commit

Permalink
Fix compilation after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Oct 31, 2024
1 parent 9ad53a1 commit 8fd40a5
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions iroh-willow/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iroh-willow"
version = "0.24.0"
version = "0.27.0"
edition = "2021"
readme = "README.md"
description = "willow protocol implementation for iroh"
Expand All @@ -18,7 +18,7 @@ workspace = true
anyhow = "1"
bytes = { version = "1.4", features = ["serde"] }
curve25519-dalek = { version = "4.1.3", features = [ "digest", "rand_core", "serde", ] }
derive_more = { version = "=1.0.0-beta.7", features = [ "debug", "deref", "display", "from", "try_into", "into", "as_ref", "try_from", ] }
derive_more = { version = "1.0.0", features = [ "debug", "deref", "display", "from", "try_into", "into", "as_ref", "try_from", ] }
ed25519-dalek = { version = "2.0.0", features = ["serde", "rand_core"] }
either = "1.13.0"
futures-buffered = "0.2.6"
Expand All @@ -27,12 +27,12 @@ futures-lite = "2.3.0"
futures-util = "0.3.30"
genawaiter = "0.99.1"
hex = "0.4.3"
iroh-base = { version = "0.24.0", path = "../iroh-base" }
iroh-base = { version = "0.27.0", path = "../iroh-base" }
iroh-blake3 = "1.4.5"
iroh-blobs = { version = "0.24.0", path = "../iroh-blobs" }
iroh-blobs = { version = "0.27.0", path = "../iroh-blobs" }
iroh-io = { version = "0.6.0", features = ["stats"] }
iroh-metrics = { version = "0.24.0", path = "../iroh-metrics", optional = true }
iroh-net = { version = "0.24.0", path = "../iroh-net" }
iroh-metrics = { version = "0.27.0", path = "../iroh-metrics", optional = true }
iroh-net = { version = "0.27.0", path = "../iroh-net" }
meadowcap = "0.1.0"
postcard = { version = "1", default-features = false, features = [ "alloc", "use-std", "experimental-derive", ] }
rand = "0.8.5"
Expand Down
4 changes: 2 additions & 2 deletions iroh-willow/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ impl Engine {
///
/// This will try to close all connections gracefully for up to 10 seconds,
/// and abort them otherwise.
pub async fn shutdown(mut self) -> Result<()> {
pub async fn shutdown(&self) -> Result<()> {
debug!("shutdown engine");
let (reply, reply_rx) = oneshot::channel();
self.peer_manager_inbox
.send(peer_manager::Input::Shutdown { reply })
.await?;
reply_rx.await?;
let res = (&mut self.peer_manager_task).await;
let res = self.peer_manager_task.clone().await;
match res {
Err(err) => error!(?err, "peer manager task panicked"),
Ok(Err(err)) => error!(?err, "peer manager task failed"),
Expand Down
2 changes: 1 addition & 1 deletion iroh-willow/src/engine/peer_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl PeerManager {
let fut = async move {
debug!("connecting");
let conn = tokio::select! {
res = endpoint.connect_by_node_id(peer, ALPN) => res,
res = endpoint.connect(peer, ALPN) => res,
_ = cancel_dial.cancelled() => {
debug!("dial cancelled during dial");
return Err(ConnectionError::LocallyClosed.into());
Expand Down
30 changes: 0 additions & 30 deletions iroh/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,30 +464,6 @@ impl<D: iroh_blobs::store::Store> NodeInner<D> {
async fn shutdown(&self, protocols: Arc<ProtocolMap>) {
let error_code = Closed::ProviderTerminating;

// Shutdown future for the docs engine, if enabled.
let docs_shutdown = {
let docs = self.docs.clone();
async move {
if let Some(docs) = docs {
docs.shutdown().await
} else {
Ok(())
}
}
};

// Shutdown willow gracefully.
let spaces_shutdown = {
let engine = self.willow.clone();
async move {
if let Some(engine) = engine {
if let Err(error) = engine.shutdown().await {
warn!(?error, "Error while shutting down willow");
}
}
}
};

// We ignore all errors during shutdown.
let _ = tokio::join!(
// Close the endpoint.
Expand All @@ -497,12 +473,6 @@ impl<D: iroh_blobs::store::Store> NodeInner<D> {
self.endpoint
.clone()
.close(error_code.into(), error_code.reason()),
// Shutdown docs engine.
docs_shutdown,
// Shutdown spaces engine.
spaces_shutdown,
// Shutdown blobs store engine.
self.db.shutdown(),
// Shutdown protocol handlers.
protocols.shutdown(),
);
Expand Down
2 changes: 1 addition & 1 deletion iroh/src/node/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ impl<D: iroh_blobs::store::Store> ProtocolBuilder<D> {
}

if let Some(engine) = self.inner.willow.clone() {
self = self.accept(iroh_willow::ALPN, Arc::new(engine));
self = self.accept(iroh_willow::ALPN.to_vec(), Arc::new(engine));
}

self
Expand Down
8 changes: 8 additions & 0 deletions iroh/src/node/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,12 @@ impl ProtocolHandler for iroh_willow::Engine {
fn accept(self: Arc<Self>, conn: Connecting) -> BoxedFuture<Result<()>> {
Box::pin(async move { self.handle_connection(conn.await?).await })
}

fn shutdown(self: Arc<Self>) -> BoxedFuture<()> {
Box::pin(async move {
if let Err(e) = (&**self).shutdown().await {
tracing::error!(?e, "Error while shutting down willow engine");
}
})
}
}

0 comments on commit 8fd40a5

Please sign in to comment.