runtime: type-erase the interface spawn future so its arms compile once

This commit is contained in:
DeFiDude committed 2026-11-16 15:46:05 -07:00
1 parent a25e7d384e
commit 0fa0d5e978
2 files changed
+36 -1

No files matched your search

+1
View File
@@ -5,6 +5,7 @@
- Bluetooth Peer runs in Gateway mode, so a node with transport on looks up the paths its Bluetooth peers ask for that it doesn't know yet. Nodes with transport off behave as before.
- TCP and Backbone client interfaces report why they can't connect: `last_connect_error` (`refused`, `timed_out`, `dns`, `unreachable`, `closed_by_peer`, or `other`) and `connect_failures` in the interface stats, so an application can tell a hub that refuses or closes the connection from one still connecting. The shared-instance RPC doesn't carry them.
- I2P interfaces log their `.b32.i2p` address once reachable, at loglevel 5 or higher, as Python Reticulum does.
- Interface start-up code is compiled once instead of again in every crate that starts the runtime, which makes `rnsd-rs` about 1.5 MB smaller.
- Announce handler events carry `emitted`, the time the announcer stamped into the announce, so an application can tell an older cached announce in a path response from a newer one. `AnnounceHandlerEvent` struct literals need the new field.
## 1.5.0 - 2026-11-13
+35 -1
View File
@@ -10440,8 +10440,42 @@ async fn finish_interface_shutdown(
}
}
type InterfaceSpawnFuture<'a> =
std::pin::Pin<Box<dyn Future<Output = Result<Vec<OwnedInterfaceHandle>, String>> + Send + 'a>>;
/// Type-erased so the spawn arms compile once, here, rather than again in every
/// crate that awaits a caller.
#[allow(clippy::too_many_arguments)]
async fn spawn_interface_with_rnode_startup_options(
fn spawn_interface_with_rnode_startup_options<'a>(
iface_config: &'a interface_factory::InterfaceConfig,
id: u64,
further_ids: &'a [u64],
transport_tx: mpsc::Sender<TransportMessage>,
id_gen: Arc<AtomicU64>,
handle_tx: mpsc::Sender<rns_interface::traits::InterfaceHandle>,
socket_base: &'a Path,
storage_dir: &'a Path,
is_foreground: Arc<AtomicBool>,
rnode_startup_options: rns_interface::rnode::RNodeStartupOptions,
tunnel_identity: &'a rns_interface::traits::TunnelIdentity,
) -> InterfaceSpawnFuture<'a> {
Box::pin(spawn_configured_interface_driver(
iface_config,
id,
further_ids,
transport_tx,
id_gen,
handle_tx,
socket_base,
storage_dir,
is_foreground,
rnode_startup_options,
tunnel_identity,
))
}
#[allow(clippy::too_many_arguments)]
async fn spawn_configured_interface_driver(
iface_config: &interface_factory::InterfaceConfig,
id: u64,
further_ids: &[u64],