fix(peer): preserve advertised addresses for QUIC peers
After renewing the dev certificate, peers could complete handshakes but then lost each other during liveness checks. Inbound QUIC streams report the client's ephemeral source port, while the peer database is supposed to track the peer's advertised listening address. Recording the ephemeral address created unstable peer entries that could not be pinged later. Resolve transport source addresses back to the unique known peer on the same IP, and keep an existing advertised address when an inbound Hello arrives from that peer. Goodbye events now report the stored peer address as well. This keeps the core peer behavior in lanspread-peer; the CLI only observes the resulting peer snapshots. Test Plan: - just fmt - just test - just clippy - just peer-cli-build - just peer-cli-image - just peer-cli-alpha, just peer-cli-bravo, just peer-cli-charlie - list-peers after the ping idle window shows advertised peer addresses with populated game lists instead of ephemeral-port peers disappearing Refs: PEER_CLI_SCENARIOS.md
This commit is contained in:
@@ -11,7 +11,7 @@ pub async fn ensure_peer_id_for_addr(
|
||||
peer_addr: SocketAddr,
|
||||
) -> PeerId {
|
||||
let mut db = peer_game_db.write().await;
|
||||
if let Some(peer_id) = db.peer_id_for_addr(&peer_addr).cloned() {
|
||||
if let Some(peer_id) = db.peer_id_for_transport_addr(&peer_addr) {
|
||||
return peer_id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user