Example #1
0
        private Host GetHost()
        {
            if (_shutdownInProgress) {
                return null;
            }

            Host host = _host;

            if (host == null) {
                lock (this) {
                    host = _host;
                    if (host == null) {
                        string uniqueAppString = String.Concat(_virtualPath, _physicalPath).ToLowerInvariant();
                        string appId = (uniqueAppString.GetHashCode()).ToString("x", CultureInfo.InvariantCulture);
                        _host = (Host)_appManager.CreateObject(appId, typeof(Host), _virtualPath, _physicalPath, /* failIfExists */ false);
                        _host.Configure(this, _port, _virtualPath, _physicalPath);
                        host = _host;
                    }
                }
            }

            return host;
        }
Example #2
0
        public void Stop()
        {
            _shutdownInProgress = true;

            try {
                if (_socket != null) {
                    _socket.Close();
                }
            }
            catch {
            }
            finally {
                _socket = null;
            }

            try {
                if (_host != null) {
                    _host.Shutdown();
                }

                while (_host != null) {
                    Thread.Sleep(100);
                }
            }
            catch {
            }
            finally {
                _host = null;
            }
        }
Example #3
0
 internal void HostStopped()
 {
     _host = null;
 }
Example #4
0
 public Request(Server server, Host host, Connection connection)
     : base(String.Empty, String.Empty, null)
 {
     _server = server;
     _host = host;
     _connection = connection;
 }