anchor.diff:          .timeout(settings.startTimeout - stopwatch.elapsed, onTimeout: onTimeout);
       }
   
  -    _heartbeatTimer = 
  -        new Timer.periodic(new Duration(seconds: 1), (_) => _heartbeat());
  -    
       _state = running;
  +
  +    //heartbeat is used to detect leak and destroy idle connection
  +    _heartbeatDuration = settings.leakDetectionThreshold != null ?
  +        new Duration(milliseconds: math.max(1000,
  +            settings.leakDetectionThreshold.inMilliseconds ~/ 3)):
  +        new Duration(seconds: math.max(60,
  +            settings.idleTimeout.inSeconds ~/ 3));
  +    _heartbeat(); //start heartbeat
     }
     
     Future _establishConnection() async {
  
positive.code:     _debug('Destroy connection. ${pconn.name}');
      if (pconn._connection != null) pconn._connection.close();
      pconn._state = connClosed;
      _connections.remove(pconn);
    }
    
    /// Depreciated. Use [stop]() instead.
  
negative.code:             'These will be closed and new connections started.'));
        
        // Forcefully close leaked connections.
        _forEachConnection(_destroyConnection);
        
        // Start new connections in parallel.
        for (int i = 0; i < settings.minConnections; i++) {
          _establishConnectionSafely();
        }
      }
    }
  