Connect engine NetworkingManager to Bevy GossipBridge

- Engine creates GossipBridge and returns it via NetworkingStarted event
- NetworkingManager forwards incoming gossip → GossipBridge.push_incoming()
- NetworkingManager polls GossipBridge.try_recv_outgoing() → broadcasts via iroh
- Bevy inserts GossipBridge resource when networking starts
- Added Debug impl for GossipBridge

Fixes gossip layer connectivity between iroh network and Bevy sync systems.

References: #131, #132
Signed-off-by: Sienna Meridian Satterwhite <sienna@r3t.io>
This commit is contained in:
2025-12-24 14:01:22 +00:00
parent 8ca02fd492
commit 3e840908f6
6 changed files with 64 additions and 10 deletions

View File

@@ -42,6 +42,7 @@ fn detect_changes_and_tick(
/// 1. Polls all available events from the EngineBridge
/// 2. Dispatches them to update Bevy resources and state
fn poll_engine_events(
mut commands: Commands,
bridge: Res<EngineBridge>,
mut current_session: ResMut<CurrentSession>,
mut node_clock: ResMut<NodeVectorClock>,
@@ -51,10 +52,14 @@ fn poll_engine_events(
if !events.is_empty() {
for event in events {
match event {
EngineEvent::NetworkingStarted { session_id, node_id } => {
EngineEvent::NetworkingStarted { session_id, node_id, bridge: gossip_bridge } => {
info!("Networking started: session={}, node={}",
session_id.to_code(), node_id);
// Insert GossipBridge for Bevy systems to use
commands.insert_resource(gossip_bridge);
info!("Inserted GossipBridge resource");
// Update session to use the new session ID and set state to Active
current_session.session = Session::new(session_id.clone());
current_session.session.state = SessionState::Active;