@push.rocks/smartproxy 19.6.1 → 19.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -488,14 +488,19 @@ export class ConnectionManager extends LifecycleComponent {
488
488
  // Check for half-zombie: one socket destroyed
489
489
  if (incomingDestroyed || outgoingDestroyed) {
490
490
  const age = now - record.incomingStartTime;
491
- // Give it 30 seconds grace period for normal cleanup
492
- if (age > 30000) {
491
+ // Use longer grace period for encrypted connections (5 minutes vs 30 seconds)
492
+ const gracePeriod = record.isTLS ? 300000 : 30000;
493
+
494
+ // Also ensure connection is old enough to avoid premature cleanup
495
+ if (age > gracePeriod && age > 10000) {
493
496
  logger.log('warn', `Half-zombie connection detected: ${connectionId} - ${incomingDestroyed ? 'incoming' : 'outgoing'} destroyed`, {
494
497
  connectionId,
495
498
  remoteIP: record.remoteIP,
496
499
  age: plugins.prettyMs(age),
497
500
  incomingDestroyed,
498
501
  outgoingDestroyed,
502
+ isTLS: record.isTLS,
503
+ gracePeriod: plugins.prettyMs(gracePeriod),
499
504
  component: 'connection-manager'
500
505
  });
501
506
 
@@ -507,8 +512,11 @@ export class ConnectionManager extends LifecycleComponent {
507
512
  // Check for stuck connections: no data sent back to client
508
513
  if (!record.connectionClosed && record.outgoing && record.bytesReceived > 0 && record.bytesSent === 0) {
509
514
  const age = now - record.incomingStartTime;
510
- // If connection is older than 60 seconds and no data sent back, likely stuck
511
- if (age > 60000) {
515
+ // Use longer grace period for encrypted connections (5 minutes vs 60 seconds)
516
+ const stuckThreshold = record.isTLS ? 300000 : 60000;
517
+
518
+ // If connection is older than threshold and no data sent back, likely stuck
519
+ if (age > stuckThreshold) {
512
520
  logger.log('warn', `Stuck connection detected: ${connectionId} - received ${record.bytesReceived} bytes but sent 0 bytes`, {
513
521
  connectionId,
514
522
  remoteIP: record.remoteIP,
@@ -516,6 +524,8 @@ export class ConnectionManager extends LifecycleComponent {
516
524
  bytesReceived: record.bytesReceived,
517
525
  targetHost: record.targetHost,
518
526
  targetPort: record.targetPort,
527
+ isTLS: record.isTLS,
528
+ threshold: plugins.prettyMs(stuckThreshold),
519
529
  component: 'connection-manager'
520
530
  });
521
531