/// <summary>
        /// Starts receiving the HTTP requests.
        /// </summary>
        public void Start()
        {
            lock (_sync) {
                var msg = _state.CheckIfAvailable(true, false, false) ?? checkIfCertificateExists();
                if (msg != null)
                {
                    _logger.Error(msg);
                    return;
                }

                _services.Start();
                startReceiving();

                _state = ServerState.Start;
            }
        }
예제 #2
0
        private void start(ServerSslConfiguration sslConfig)
        {
            if (_state == ServerState.Start)
            {
                _log.Info("The server has already started.");
                return;
            }

            if (_state == ServerState.ShuttingDown)
            {
                _log.Warn("The server is shutting down.");
                return;
            }

            lock (_sync) {
                if (_state == ServerState.Start)
                {
                    _log.Info("The server has already started.");
                    return;
                }

                if (_state == ServerState.ShuttingDown)
                {
                    _log.Warn("The server is shutting down.");
                    return;
                }

                _sslConfigInUse = sslConfig;
                _realmInUse     = getRealm();

                _services.Start();
                try {
                    startReceiving();
                }
                catch {
                    _services.Stop(1011, String.Empty);
                    throw;
                }

                _state = ServerState.Start;
            }
        }