bidirectional ip reflection for listener address discovery

This commit is contained in:
2026-02-09 16:02:23 -03:00
parent 59e9e420be
commit 7b47ef155c
31 changed files with 3192 additions and 269 deletions

View File

@@ -277,6 +277,7 @@ fn handleDhtMessageImpl(p2p: *P2P, connection_peer_id: PeerId, payload: []const
std.log.warn("DHT: Failed to deserialize message (len={})", .{payload.len});
return;
};
defer dht.freeDhtMessage(p2p.allocator, msg);
// CRITICAL: Set the connection peer ID as source before processing
// This allows DHT handlers to auto-register the node_id -> peer_id mapping
@@ -287,8 +288,6 @@ fn handleDhtMessageImpl(p2p: *P2P, connection_peer_id: PeerId, payload: []const
registry.processMessage(msg) catch |err| {
std.log.warn("DHT: Failed to process message: {}", .{err});
};
std.log.debug("DHT: Processed message from peer", .{});
}
/// Callback for peer disconnection from NetworkManager