void IGatewaySync.Stop(bool stopListenOnly)
        {
            _logger?.Info($"Stop (StopListenOnly={stopListenOnly})");

            // stop listening

            _isStopped = true;

            if (_tcpAcceptor != null)
            {
                _tcpAcceptor.Close();
                _tcpAcceptor = null;
            }

            if (stopListenOnly)
            {
                return;
            }

            // stop all running channels

            _isStopped = true;

            if (_channelSet.Count > 0)
            {
                foreach (var channel in _channelSet)
                {
                    channel.Cast <ActorBoundChannelRef>().WithNoReply().Close();
                }
            }
            else
            {
                Self.Tell(InterfacedPoisonPill.Instance);
            }
        }
        void IGatewaySync.Start()
        {
            _logger?.InfoFormat("Start (EndPoint={0})", _initiator.ListenEndPoint);

            try
            {
                _tcpAcceptor           = new TcpAcceptor();
                _tcpAcceptor.Accepted += OnConnectionAccept;
                _tcpAcceptor.Listen(_initiator.ListenEndPoint);
            }
            catch (Exception e)
            {
                _logger?.ErrorFormat("Start got exception.", e);
            }
        }
        void IGatewaySync.Start()
        {
            _logger?.InfoFormat("Start (EndPoint={0})", _initiator.ListenEndPoint);

            try
            {
                _tcpAcceptor = new TcpAcceptor();
                _tcpAcceptor.Accepted += OnConnectionAccept;
                _tcpAcceptor.Listen(_initiator.ListenEndPoint);
            }
            catch (Exception e)
            {
                _logger?.ErrorFormat("Start got exception.", e);
            }
        }
 private TcpAcceptor.AcceptResult OnConnectionAccept(TcpAcceptor sender, Socket socket)
 {
     _self.Tell(new AcceptMessage(socket), _self);
     return TcpAcceptor.AcceptResult.Accept;
 }
        void IGatewaySync.Stop(bool stopListenOnly)
        {
            _logger?.Info($"Stop (StopListenOnly={stopListenOnly})");

            // stop listening

            _isStopped = true;

            if (_tcpAcceptor != null)
            {
                _tcpAcceptor.Close();
                _tcpAcceptor = null;
            }

            if (stopListenOnly)
                return;

            // stop all running channels

            _isStopped = true;

            if (_channelSet.Count > 0)
            {
                foreach (var channel in _channelSet)
                    channel.Cast<ActorBoundChannelRef>().WithNoReply().Close();
            }
            else
            {
                Self.Tell(InterfacedPoisonPill.Instance);
            }
        }
 private TcpAcceptor.AcceptResult OnConnectionAccept(TcpAcceptor sender, Socket socket)
 {
     _self.Tell(new AcceptMessage(socket), _self);
     return(TcpAcceptor.AcceptResult.Accept);
 }