fix(remoteingress-core): preserve reconnected edge entries during disconnect cleanup

This commit is contained in:
2026-03-20 00:11:34 +00:00
parent c7641853cf
commit e84eecf82c
3 changed files with 17 additions and 3 deletions

View File

@@ -1073,7 +1073,11 @@ async fn handle_edge_connection(
).await;
{
let mut edges = connected.lock().await;
edges.remove(&edge_id);
// Only remove if the entry is still ours (not replaced by a reconnection).
// A replaced entry has a fresh non-cancelled token from the new handler.
if edges.get(&edge_id).map_or(false, |e| e.cancel_token.is_cancelled()) {
edges.remove(&edge_id);
}
}
let _ = event_tx.try_send(HubEvent::EdgeDisconnected {
edge_id: edge_id.clone(),
@@ -1534,7 +1538,11 @@ async fn handle_edge_connection_quic(
{
let mut edges = connected.lock().await;
edges.remove(&edge_id);
// Only remove if the entry is still ours (not replaced by a reconnection).
// A replaced entry has a fresh non-cancelled token from the new handler.
if edges.get(&edge_id).map_or(false, |e| e.cancel_token.is_cancelled()) {
edges.remove(&edge_id);
}
}
let _ = event_tx.try_send(HubEvent::EdgeDisconnected {
edge_id,