Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Jun 12, 2024
1 parent 930b369 commit a439a5f
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions iroh/src/node/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ where
self
}

/// Disable documents support on this node completely.
/// Disables documents support on this node completely.
pub fn disable_docs(mut self) -> Self {
self.docs_store = None;
self
Expand Down Expand Up @@ -628,7 +628,10 @@ where
) {
let server = inner.endpoint.clone();
let docs = protocols.get::<DocsEngine>(DOCS_ALPN);
let handler = rpc::Handler { inner, docs };
let handler = rpc::Handler {
inner: inner.clone(),
docs,
};
let rpc = RpcServer::new(rpc);
let internal_rpc = RpcServer::new(internal_rpc);
let (ipv4, ipv6) = server.local_addr();
Expand Down Expand Up @@ -709,7 +712,9 @@ where
}
};
let protocols = protocols.clone();
tokio::task::spawn(async move {
let mut tasks_guard = inner.tasks.lock().unwrap();
let tasks = tasks_guard.as_mut().expect("only empty after shutdown");
tasks.spawn(async move {
if let Err(err) = handle_connection(connecting, alpn, protocols).await {
warn!("Handling incoming connection ended with error: {err}");
}
Expand Down Expand Up @@ -838,33 +843,6 @@ async fn handle_connection(
} else {
bail!("ignoring connection: unsupported ALPN protocol");
}
// match alpn.as_bytes() {
// GOSSIP_ALPN => gossip.handle_connection(connecting.await?).await?,
// DOCS_ALPN => sync.handle_connection(connecting).await?,
// iroh_blobs::protocol::ALPN => {
// let connection = connecting.await?;
// iroh_blobs::provider::handle_connection(
// connection,
// node.db.clone(),
// MockEventSender,
// node.rt.clone(),
// )
// .await
// }
// alpn => {
// let protocol = {
// let protocols = protocols.read().unwrap();
// protocols.get(alpn).cloned()
// };
// if let Some(protocol) = protocol {
// drop(protocols);
// let connection = connecting.await?;
// protocol.accept(connection).await?;
// } else {
// bail!("ignoring connection: unsupported ALPN protocol");
// }
// }
// }
Ok(())
}

Expand Down

0 comments on commit a439a5f

Please sign in to comment.