Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
311691c2cc | |||
578d1ba2f7 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartproxy",
|
"name": "@push.rocks/smartproxy",
|
||||||
"version": "19.5.21",
|
"version": "19.5.22",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.",
|
"description": "A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -199,25 +199,29 @@ 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,
|
||||||
|
remoteIP: record.remoteIP,
|
||||||
|
reason,
|
||||||
|
hasOutgoing: !!record.outgoing,
|
||||||
|
outgoingState: record.outgoing?.readyState,
|
||||||
|
component: 'route-handler'
|
||||||
|
});
|
||||||
|
|
||||||
|
// If there's a pending or established outgoing connection, destroy it
|
||||||
|
if (record.outgoing && !record.outgoing.destroyed) {
|
||||||
|
logger.log('debug', `Destroying outgoing connection for ${connectionId}`, {
|
||||||
connectionId,
|
connectionId,
|
||||||
remoteIP: record.remoteIP,
|
outgoingState: record.outgoing.readyState,
|
||||||
reason,
|
|
||||||
hasOutgoing: !!record.outgoing,
|
|
||||||
outgoingState: record.outgoing?.readyState,
|
|
||||||
component: 'route-handler'
|
component: 'route-handler'
|
||||||
});
|
});
|
||||||
|
record.outgoing.destroy();
|
||||||
// If there's a pending outgoing connection, destroy it
|
|
||||||
if (record.outgoing && !record.outgoing.destroyed) {
|
|
||||||
record.outgoing.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.connectionManager.cleanupConnection(record, reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always cleanup the connection record
|
||||||
|
this.connectionManager.cleanupConnection(record, reason);
|
||||||
},
|
},
|
||||||
undefined, // Use default timeout handler
|
undefined, // Use default timeout handler
|
||||||
'immediate-route-client'
|
'immediate-route-client'
|
||||||
|
Reference in New Issue
Block a user