Beispiel #1
0
        /// <summary>
        /// Starts new server, connects to remote node clients and starts to listen incoming node connections
        /// </summary>
        public async Task Start()
        {
            foreach (TmqStickyConnector connector in Connectors)
            {
                connector.Run();
            }

            if (_nodeServer != null && _nodeServer.IsRunning)
            {
                _nodeServer.Stop();
                _nodeServer = null;
                await Task.Delay(500);
            }

            if (Server.Options.NodeHost == null)
            {
                return;
            }

            _nodeServer = new TwinoServer(new ServerOptions
            {
                Hosts = new List <HostOptions> {
                    Server.Options.NodeHost
                },
                PingInterval   = 15,
                RequestTimeout = 15
            });

            _nodeServer.Start();
        }