Exemplo n.º 1
0
        public async virtual Task ShutDown()
        {
            log.Debug("shutting down...");

            await _network.StopListeningForConnections();

            await Framework.ShutDown();

            using (var l = await RunningMutex.Lock())
            {
                Running = false;
                RunningMutex.PulseAll(l);
            }

            log.Info("shut down complete");
        }
Exemplo n.º 2
0
        public async virtual Task Start(int port)
        {
            log.Debug("start server on port " + port);

            if (!Initialized)
            {
                throw new Exception("Server has not been initialized yet!");
            }

            await Framework.InitializeModules();

            _network.StartListeningForConnections(port);

            using (var l = await RunningMutex.Lock())
            {
                Running = true;
                RunningMutex.PulseAll(l);
            }
            log.Info("server running");
        }
Exemplo n.º 3
0
        public async Task Reset(int port)
        {
            log.Debug("resetting...");

            Running = false;

            await _network.StopListeningForConnections();

            await Framework.Reset();

            using (var l = await RunningMutex.Lock())
            {
                Running = true;
                RunningMutex.PulseAll(l);
            }

            _network.StartListeningForConnections(port);

            log.Debug("reset done");
        }