fix(PortProxy): Adjust timeout settings and handle inactivity properly in PortProxy.

This commit is contained in:
Philipp Kunz 2025-03-05 18:24:28 +00:00
parent b317ab8b3a
commit fe8106f0c8
3 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,13 @@
# Changelog
## 2025-03-05 - 3.25.2 - fix(PortProxy)
Adjust timeout settings and handle inactivity properly in PortProxy.
- Changed initialDataTimeout default to 30 seconds for better handling of initial data reception.
- Adjusted keepAliveInitialDelay to 30 seconds for consistent socket optimization.
- Introduced proper inactivity handling with updated timeout logic.
- Parity check now accounts for a 120-second threshold for outgoing socket closure.
## 2025-03-05 - 3.25.1 - fix(PortProxy)
Adjust inactivity threshold to a random value between 20 and 30 minutes for better variability

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartproxy',
version: '3.25.1',
version: '3.25.2',
description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, and dynamic routing with authentication options.'
}

View File

@ -243,7 +243,7 @@ export class PortProxy {
targetIP: settingsArg.targetIP || 'localhost',
// Timeout settings with browser-friendly defaults
initialDataTimeout: settingsArg.initialDataTimeout || 15000, // 15 seconds
initialDataTimeout: settingsArg.initialDataTimeout || 30000, // 30 seconds
socketTimeout: settingsArg.socketTimeout || 300000, // 5 minutes
inactivityCheckInterval: settingsArg.inactivityCheckInterval || 30000, // 30 seconds
@ -258,7 +258,7 @@ export class PortProxy {
// Socket optimization settings
noDelay: settingsArg.noDelay !== undefined ? settingsArg.noDelay : true,
keepAlive: settingsArg.keepAlive !== undefined ? settingsArg.keepAlive : true,
keepAliveInitialDelay: settingsArg.keepAliveInitialDelay || 60000, // 1 minute
keepAliveInitialDelay: settingsArg.keepAliveInitialDelay || 30000, // 30 seconds
maxPendingDataSize: settingsArg.maxPendingDataSize || 1024 * 1024, // 1MB
// Feature flags
@ -1202,7 +1202,7 @@ export class PortProxy {
if (record.outgoingClosedTime &&
!record.incoming.destroyed &&
!record.connectionClosed &&
(now - record.outgoingClosedTime > 30000)) {
(now - record.outgoingClosedTime > 120000)) {
const remoteIP = record.remoteIP;
console.log(`[${id}] Parity check: Incoming socket for ${remoteIP} still active ${plugins.prettyMs(now - record.outgoingClosedTime)} after outgoing closed.`);
this.cleanupConnection(record, 'parity_check');