update
This commit is contained in:
parent
233c98e5ff
commit
578d1ba2f7
@ -199,9 +199,8 @@ export class RouteConnectionHandler {
|
|||||||
setupSocketHandlers(
|
setupSocketHandlers(
|
||||||
underlyingSocket,
|
underlyingSocket,
|
||||||
(reason) => {
|
(reason) => {
|
||||||
// Only cleanup if connection hasn't been fully established
|
// Always cleanup when incoming socket closes
|
||||||
// Check if outgoing connection exists and is connected
|
// This prevents connection accumulation in proxy chains
|
||||||
if (!record.outgoing || record.outgoing.readyState !== 'open') {
|
|
||||||
logger.log('debug', `Connection ${connectionId} closed during immediate routing: ${reason}`, {
|
logger.log('debug', `Connection ${connectionId} closed during immediate routing: ${reason}`, {
|
||||||
connectionId,
|
connectionId,
|
||||||
remoteIP: record.remoteIP,
|
remoteIP: record.remoteIP,
|
||||||
@ -211,13 +210,18 @@ export class RouteConnectionHandler {
|
|||||||
component: 'route-handler'
|
component: 'route-handler'
|
||||||
});
|
});
|
||||||
|
|
||||||
// If there's a pending outgoing connection, destroy it
|
// If there's a pending or established outgoing connection, destroy it
|
||||||
if (record.outgoing && !record.outgoing.destroyed) {
|
if (record.outgoing && !record.outgoing.destroyed) {
|
||||||
|
logger.log('debug', `Destroying outgoing connection for ${connectionId}`, {
|
||||||
|
connectionId,
|
||||||
|
outgoingState: record.outgoing.readyState,
|
||||||
|
component: 'route-handler'
|
||||||
|
});
|
||||||
record.outgoing.destroy();
|
record.outgoing.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always cleanup the connection record
|
||||||
this.connectionManager.cleanupConnection(record, reason);
|
this.connectionManager.cleanupConnection(record, reason);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
undefined, // Use default timeout handler
|
undefined, // Use default timeout handler
|
||||||
'immediate-route-client'
|
'immediate-route-client'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user