Beispiel #1
0
        private bool InitConnectionHandlers()
        {
            Lib.PrintLine("Starting connection handlers...");
            bool anyActiveListeners = false;

            if (Lib.Serverinfo.TcpSocketEnabled)
            {
                tcpListener = ConnectionListenerFactory.CreateTcpConnectionListener(Lib.Serverinfo.TcpSocketPort);
                tcpListener.Start();
                Lib.PrintLine("Started TcpListener on port " + Lib.Serverinfo.TcpSocketPort + ".");
                anyActiveListeners = true;
            }

            //if (Lib.Serverinfo.MsnSocketEnabled)
            //{
            //    msnListener = ConnectionListenerFactory.CreateMsnConnectionListener(Lib.Serverinfo.MsnSocketSignonEmail,
            //        Lib.Serverinfo.MsnSocketPassword);
            //    msnListener.Start();
            //    Lib.PrintLine("Started MsnListener with login " + Lib.Serverinfo.MsnSocketSignonEmail + ".");
            //    anyActiveListeners = true;
            //}

            if (!anyActiveListeners)
            {
                Lib.PrintLine("Fatal Error! No active connection listeners. Please enable one in TigerMUD.xml");
            }

            return(anyActiveListeners);
        }
Beispiel #2
0
        public ConnectionListener Hosting(Assembly startAssembly, string name, string dbConnectionString, SqlDPragmaModel pragma, EndPoint localEndPoint, params EndPoint[] forwardEndPoints)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (dbConnectionString == null)
            {
                throw new ArgumentNullException(nameof(dbConnectionString));
            }

            var dbConnection       = new DbConnection().Connect(name, dbConnectionString, pragma);
            var connectionListener = ConnectionListenerFactory.Get(startAssembly, dbConnection, localEndPoint, forwardEndPoints);

            return(connectionListener);
        }
Beispiel #3
0
        public IActionResult Kill([FromBody] KillRequest request)
        {
            return(this.Intercept(() =>
            {
                Log.Out.Warn($"Unregistering {request.EndPoint.ToUrl()}, this process is going down ... ");
                Registry.Registry.Unregister(request.EndPoint);

                var connectionListener = ConnectionListenerFactory.Find(request.EndPoint);
                if (connectionListener != null)
                {
                    ConnectionListenerFactory.Remove(connectionListener);
                    connectionListener.Dispose();
                }

                Environment.Exit(0);

                return Ok(new KillResponse(authorityAddress));
            }));
        }
        public async Task SmokeTest(Func <EndPoint> endPoint, int length, PipeScheduler schedulerMode, int threadCount, int ringSize, bool threadAffinity)
        {
            var options = Options.Create(new IoUringOptions
            {
                ThreadCount               = threadCount,
                SetThreadAffinity         = threadAffinity,
                ApplicationSchedulingMode = schedulerMode,
                RingSize = ringSize
            });

            await using var transport = new IoUringTransport(options);

            var listenerFactory = new ConnectionListenerFactory(transport, options);

            await using (var listener = await listenerFactory.BindAsync(endPoint()))
            {
                for (int i = 0; i < 3; i++)
                {
                    var client = new EchoClient(listener.EndPoint);
                    await using (var connection = await listener.AcceptAsync())
                    {
                        for (int j = 0; j < 3; j++)
                        {
                            var exchange = client.ExchangeData(length);
                            await LoopBack(connection.Transport, length);

                            await exchange;
                        }

                        await connection.Transport.Output.CompleteAsync();

                        await connection.Transport.Input.CompleteAsync();
                    }
                    client.Close();
                }
            }
        }