diff --git a/changelog.md b/changelog.md index 1784a37..726d1cd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2026-03-17 - 4.8.8 - fix(remoteingress-core) +cancel stale edge connections when an edge reconnects + +- Remove any existing edge entry before registering a reconnected edge +- Trigger the previous connection's cancellation token so stale sessions shut down immediately instead of waiting for TCP keepalive + ## 2026-03-17 - 4.8.7 - fix(remoteingress-core) perform graceful TLS shutdown on edge and hub tunnel streams diff --git a/rust/crates/remoteingress-core/src/hub.rs b/rust/crates/remoteingress-core/src/hub.rs index 18487f5..d586dc1 100644 --- a/rust/crates/remoteingress-core/src/hub.rs +++ b/rust/crates/remoteingress-core/src/hub.rs @@ -136,7 +136,7 @@ struct ConnectedEdgeInfo { peer_addr: String, edge_stream_count: Arc, config_tx: mpsc::Sender, - #[allow(dead_code)] // kept alive for Drop — cancels child tokens when edge is removed + /// Used to cancel the old connection when an edge reconnects. cancel_token: CancellationToken, } @@ -677,6 +677,13 @@ async fn handle_edge_connection( { let mut edges = connected.lock().await; + // If this edge already has an active connection (reconnect scenario), + // cancel the old connection so it shuts down immediately instead of + // lingering until TCP keepalive detects the dead socket. + if let Some(old) = edges.remove(&edge_id) { + log::info!("Edge {} reconnected, cancelling old connection", edge_id); + old.cancel_token.cancel(); + } edges.insert( edge_id.clone(), ConnectedEdgeInfo { diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 2919883..791682a 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/remoteingress', - version: '4.8.7', + version: '4.8.8', description: 'Edge ingress tunnel for DcRouter - accepts incoming TCP connections at network edge and tunnels them to DcRouter SmartProxy preserving client IP via PROXY protocol v1.' }