Skip to content

Commit e3d6a72

Browse files
committed
fixup
1 parent 27bebd8 commit e3d6a72

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ed25519-dalek = { version = "2.0.0", features = ["serde", "rand_core"] }
4848
hex = "0.4.3"
4949
indexmap = "2.0"
5050
iroh-metrics = { version = "0.32", default-features = false }
51-
n0-future = "0.1.2"
51+
iroh-base = { version = "0.34", default-features = false, features = ["key"] }
5252
postcard = { version = "1", default-features = false, features = [
5353
"alloc",
5454
"use-std",
@@ -75,11 +75,7 @@ irpc = { git = "https://github.com/n0-computer/irpc", optional = true, default-f
7575
"message_spans",
7676
] }
7777
irpc-derive = { git = "https://github.com/n0-computer/irpc", optional = true }
78-
# irpc = { path = "../irpc", optional = true, default-features = false, features = [
79-
# "stream",
80-
# "message_spans",
81-
# ] }
82-
# irpc-derive = { path = "../irpc/irpc-derive", optional = true }
78+
n0-future = { version = "0.1.2", optional = true }
8379

8480
# rpc dependencies
8581
quinn = { package = "iroh-quinn", version = "0.13.0", optional = true }
@@ -130,12 +126,22 @@ net = [
130126
"dep:tokio",
131127
"dep:tokio-util",
132128
"dep:async-channel",
129+
"dep:n0-future",
133130
"dep:futures-util",
134131
"dep:futures-concurrency",
135132
"dep:anyhow",
136133
"dep:thiserror",
137134
]
138-
rpc = ["net", "dep:quinn", "irpc/rpc", "irpc/quinn_endpoint_setup"]
135+
rpc = [
136+
"dep:irpc",
137+
"dep:irpc-derive",
138+
"dep:tokio",
139+
"dep:quinn",
140+
"dep:n0-future",
141+
"dep:thiserror",
142+
"irpc/rpc",
143+
"irpc/quinn_endpoint_setup",
144+
]
139145
test-utils = ["dep:rand_chacha", "dep:humantime-serde"]
140146
simulator = [
141147
"test-utils",

src/api.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ use std::{
99
};
1010

1111
use bytes::Bytes;
12-
use futures_lite::{Stream, StreamExt};
13-
use iroh::NodeId;
14-
use irpc::{channel::spsc, Client, LocalSender};
12+
use iroh_base::NodeId;
13+
use irpc::{channel::spsc, Client};
1514
use irpc_derive::rpc_requests;
16-
use n0_future::TryStreamExt;
15+
use n0_future::{Stream, StreamExt, TryStreamExt};
1716
use serde::{Deserialize, Serialize};
1817

1918
use crate::proto::{DeliveryScope, TopicId};
@@ -42,13 +41,13 @@ pub(crate) struct JoinRequest {
4241
pub bootstrap: BTreeSet<NodeId>,
4342
}
4443

45-
///
44+
/// Errors returned from methods in [`GossipApi`]
4645
#[derive(Debug, thiserror::Error)]
4746
pub enum ApiError {
4847
/// RPC error
4948
#[error(transparent)]
5049
Rpc(#[from] irpc::Error),
51-
///
50+
/// Received an unexpected event.
5251
#[error("received unexpected event")]
5352
UnexpectedEvent,
5453
}
@@ -72,8 +71,9 @@ pub struct GossipApi {
7271
}
7372

7473
impl GossipApi {
74+
#[cfg(feature = "net")]
7575
pub(crate) fn local(tx: tokio::sync::mpsc::Sender<RpcMessage>) -> Self {
76-
let local = LocalSender::<RpcMessage, Service>::from(tx);
76+
let local = irpc::LocalSender::<RpcMessage, Service>::from(tx);
7777
Self {
7878
client: local.into(),
7979
}
@@ -87,7 +87,7 @@ impl GossipApi {
8787
}
8888

8989
/// Listen on a quinn endpoint for incoming RPC connections.
90-
#[cfg(feature = "rpc")]
90+
#[cfg(all(feature = "rpc", feature = "net"))]
9191
pub(crate) async fn listen(&self, endpoint: quinn::Endpoint) {
9292
use std::sync::Arc;
9393

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#[doc(inline)]
1414
pub use net::GOSSIP_ALPN as ALPN;
1515

16+
#[cfg(any(feature = "net", feature = "rpc"))]
1617
pub mod api;
1718
pub mod metrics;
1819
#[cfg(feature = "net")]

src/net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ struct TopicState {
850850
joined: bool,
851851
neighbors: BTreeSet<NodeId>,
852852
event_sender: broadcast::Sender<GossipEvent>,
853-
/// Keys identifying [`GossipSender`]s.
853+
/// Keys identifying command receivers in [`Actor::command_rx`].
854854
///
855855
/// This represents the receiver side of gossip's publish public API.
856856
command_rx_keys: HashSet<stream_group::Key>,
@@ -982,7 +982,7 @@ async fn topic_subscriber_loop(
982982
Err(broadcast::error::RecvError::Lagged(_)) => Event::Lagged,
983983
Ok(event) => Event::Gossip(event)
984984
};
985-
if let Err(_) = sender.send(event).await {
985+
if sender.send(event).await.is_err() {
986986
break;
987987
}
988988
}

0 commit comments

Comments
 (0)