Skip to content

Commit 4e0719a

Browse files
committed
refactor: adapt to iroh on main
new way to do protocol accept
1 parent 4c1446f commit 4e0719a

File tree

5 files changed

+24
-58
lines changed

5 files changed

+24
-58
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,5 @@ incremental = false
185185

186186
[patch.crates-io]
187187
# iroh-metrics = { git = "https://github.com/n0-computer/iroh", branch = "main" }
188-
# iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" }
189-
# iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" }
188+
iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" }
189+
iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" }

examples/transfer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::{path::PathBuf, str::FromStr};
22

33
use anyhow::Result;
4-
use iroh::{protocol::Router, Endpoint};
5-
use iroh_base::ticket::BlobTicket;
4+
use iroh::{protocol::Router, ticket::BlobTicket, Endpoint};
65
use iroh_blobs::{
76
net_protocol::Blobs,
87
rpc::client::blobs::{ReadAtLen, WrapOption},

src/net_protocol.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -451,22 +451,20 @@ impl<S: crate::store::Store> Blobs<S> {
451451
// }
452452

453453
impl<S: crate::store::Store> ProtocolHandler for Blobs<S> {
454-
fn accept(self: Arc<Self>, conn: Connecting) -> BoxedFuture<Result<()>> {
454+
fn accept(&self, conn: Connecting) -> BoxedFuture<Result<()>> {
455+
let db = self.store.clone();
456+
let events = self.events.clone();
457+
let rt = self.rt.clone();
455458
Box::pin(async move {
456-
crate::provider::handle_connection(
457-
conn.await?,
458-
self.store.clone(),
459-
self.events.clone(),
460-
self.rt.clone(),
461-
)
462-
.await;
459+
crate::provider::handle_connection(conn.await?, db, events, rt).await;
463460
Ok(())
464461
})
465462
}
466463

467-
fn shutdown(self: Arc<Self>) -> BoxedFuture<()> {
464+
fn shutdown(&self) -> BoxedFuture<()> {
465+
let store = self.store.clone();
468466
Box::pin(async move {
469-
self.store.shutdown().await;
467+
store.shutdown().await;
470468
})
471469
}
472470
}

src/rpc/client/blobs.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,10 @@ pub struct DownloadOptions {
991991
mod tests {
992992
use std::{path::Path, time::Duration};
993993

994-
use iroh::{key::SecretKey, test_utils::DnsPkarrServer, NodeId, RelayMode};
995-
use iroh_base::{node_addr::AddrInfoOptions, ticket::BlobTicket};
994+
use iroh::{
995+
key::SecretKey, test_utils::DnsPkarrServer, ticket::BlobTicket, AddrInfoOptions, NodeId,
996+
RelayMode,
997+
};
996998
use node::Node;
997999
use rand::RngCore;
9981000
use testresult::TestResult;

0 commit comments

Comments
 (0)