Skip to content

Commit 8135c79

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

File tree

5 files changed

+31
-59
lines changed

5 files changed

+31
-59
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,15 @@ rpc = [
110110
"dep:quic-rpc-derive",
111111
"dep:serde-error",
112112
"dep:portable-atomic",
113+
"iroh-blobs/rpc",
113114
]
114115

115116
[package.metadata.docs.rs]
116117
all-features = true
117118
rustdoc-args = ["--cfg", "iroh_docsrs"]
119+
120+
[patch.crates-io]
121+
iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" }
122+
iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" }
123+
iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "main" }
124+
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
})

tests/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ impl<S: BlobStore> Builder<S> {
144144
endpoint.clone(),
145145
local_pool.handle().clone(),
146146
);
147-
let blobs = Arc::new(iroh_blobs::net_protocol::Blobs::new(
147+
let blobs = iroh_blobs::net_protocol::Blobs::new(
148148
store.clone(),
149149
local_pool.handle().clone(),
150150
Default::default(),
151151
downloader.clone(),
152152
endpoint.clone(),
153-
));
153+
);
154154
let gossip = iroh_gossip::net::Gossip::from_endpoint(
155155
endpoint.clone(),
156156
Default::default(),

0 commit comments

Comments
 (0)