Skip to content

Commit c7d09da

Browse files
committed
refactor: adapt to new ProtocolHandler
1 parent 5897668 commit c7d09da

File tree

4 files changed

+28
-57
lines changed

4 files changed

+28
-57
lines changed

Cargo.lock

Lines changed: 11 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,9 @@ rpc = [
115115
[package.metadata.docs.rs]
116116
all-features = true
117117
rustdoc-args = ["--cfg", "iroh_docsrs"]
118+
119+
[patch.crates-io]
120+
iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" }
121+
iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" }
122+
iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "main" }
123+
iroh-gossip = { git = "https://github.com/n0-computer/iroh-gossip", branch = "main" }

deny.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ ignore = [
3737
]
3838

3939
[sources]
40-
allow-git = []
40+
allow-git = [
41+
"https://github.com/n0-computer/iroh.git",
42+
"https://github.com/n0-computer/iroh-blobs.git",
43+
"https://github.com/n0-computer/iroh-gossip.git",
44+
]

src/protocol.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
//! [`ProtocolHandler`] implementation for the docs [`Engine`].
22
3-
use std::sync::Arc;
4-
53
use anyhow::Result;
64
use futures_lite::future::Boxed as BoxedFuture;
75
use iroh::{endpoint::Connecting, protocol::ProtocolHandler};
86

97
use crate::engine::Engine;
108

119
impl<D: iroh_blobs::store::Store> ProtocolHandler for Engine<D> {
12-
fn accept(self: Arc<Self>, conn: Connecting) -> BoxedFuture<Result<()>> {
13-
Box::pin(async move { self.handle_connection(conn).await })
10+
fn accept(&self, conn: Connecting) -> BoxedFuture<Result<()>> {
11+
let this = self.clone();
12+
Box::pin(async move { this.handle_connection(conn).await })
1413
}
1514

16-
fn shutdown(self: Arc<Self>) -> BoxedFuture<()> {
15+
fn shutdown(&self) -> BoxedFuture<()> {
16+
let this = self.clone();
1717
Box::pin(async move {
18-
if let Err(err) = (*self).shutdown().await {
18+
if let Err(err) = this.shutdown().await {
1919
tracing::warn!("shutdown error: {:?}", err);
2020
}
2121
})

0 commit comments

Comments
 (0)