/// <summary>
        ///     Supervisor actor used to determine if we need to log warning about increase in TCP ports or terminate the
        ///     Actor System.
        /// </summary>
        public TcpPortUseSupervisor(SocketLeakDetectorSettings settings, IEnumerable <IPAddress> ips)
        {
            _settings             = settings;
            _monitoredIPAddresses = ips.ToList();
            _childProps           = Props.Create(() => new SocketLeakDetectorActor(_settings, Self));

            Receive <TcpCount>(t =>
            {
                if (_monitoredIPAddresses.Count == 0 || _monitoredIPAddresses.Contains(t.HostInterface))
                {
                    var childName = Uri.EscapeUriString(t.HostInterface.ToString());
                    var child     = Context.Child(childName).GetOrElse(() =>
                                                                       Context.ActorOf(_childProps, childName));

                    child.Forward(t);
                }
            });

            Receive <Shutdown>(_ =>
            {
                _log.Warning("Received shutdown notification from LeakDetector. Terminating ActorSystem");

                // trigger shutdown using custom reason
                CoordinatedShutdown.Get(Context.System).Run(PortLeakReason.Instance);
            });
        }
 public TcpPortMonitoringActor(IActorRef supervisor, SocketLeakDetectorSettings settings)
 {
     _supervisor = supervisor;
     _settings   = settings;
 }
 public LeakDetector(SocketLeakDetectorSettings settings)
     : this(settings.MinPorts, settings.MaxDifference,
            settings.MaxPorts, settings.ShortSampleSize, settings.LongSampleSize)
 {
 }
 /// <summary>
 ///     Supervisor actor used to determine if we need to log warning about increase in TCP ports or terminate the
 ///     Actor System.
 ///     Created using the default <see cref="SocketLeakDetectorSettings" />.
 ///     With Set list of IP Address to check for.
 /// </summary>
 public TcpPortUseSupervisor(SocketLeakDetectorSettings settings) : this(new SocketLeakDetectorSettings(), new List <IPAddress>())
 {
 }
 /// <summary>
 ///     Constructor will setup the values that we will need to determine if we need to message our supervisor actor in case
 ///     we experience an increase in TCP ports
 /// </summary>
 /// <param name="settings">The settings for this actor's leak detection algorithm.</param>
 /// <param name="supervisor">Actor Reference for the Supervisor Actor in charge of terminating Actor System</param>
 public SocketLeakDetectorActor(SocketLeakDetectorSettings settings, IActorRef supervisor)
 {
     _supervisor = supervisor;
     _settings   = settings;
 }