Esempio n. 1
0
        /// <summary>
        /// Stops receiving incoming requests.
        /// </summary>
        /// <exception cref="ObjectDisposedException">
        /// This listener has been closed.
        /// </exception>
        public void Stop()
        {
            CheckDisposed();

            if (!_listening)
            {
                return;
            }

            lock (_contextRegistrySync) {
                if (!_listening)
                {
                    return;
                }

                _listening = false;

                cleanupContextQueue(false);
                cleanupContextRegistry();

                var msg = "The listener is stopped.";
                var ex  = new HttpListenerException(995, msg);
                cleanupWaitQueue(ex);

                EndPointManager.RemoveListener(this);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Stops receiving incoming requests.
        /// </summary>
        /// <exception cref="ObjectDisposedException">
        /// This listener has been closed.
        /// </exception>
        public void Stop()
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(_objectName);
            }

            lock (_contextRegistrySync) {
                if (_disposed)
                {
                    throw new ObjectDisposedException(_objectName);
                }

                if (!_listening)
                {
                    return;
                }

                _listening = false;

                cleanupContextQueue(false);
                cleanupContextRegistry();

                var msg = "The listener is stopped.";
                cleanupWaitQueue(msg);

                EndPointManager.RemoveListener(this);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Removes all URI prefixes from the collection.
 /// </summary>
 /// <exception cref="ObjectDisposedException">
 /// The <see cref="HttpListener"/> associated with this collection is closed.
 /// </exception>
 public void Clear()
 {
     _listener.CheckDisposed();
     _prefixes.Clear();
     if (_listener.IsListening)
     {
         EndPointManager.RemoveListener(_listener);
     }
 }
Esempio n. 4
0
 public void Stop()
 {
     CheckDisposed();
     if (_listening)
     {
         _listening = false;
         EndPointManager.RemoveListener(this);
         sendServiceUnavailable();
     }
 }
Esempio n. 5
0
 public void Stop()
 {
     this.CheckDisposed();
     if (!this._listening)
     {
         return;
     }
     this._listening = false;
     EndPointManager.RemoveListener(this);
     this.sendServiceUnavailable();
 }
        /// <summary>
        /// Removes all URI prefixes from the collection.
        /// </summary>
        /// <exception cref="ObjectDisposedException">
        /// The <see cref="HttpListener"/> instance associated with this
        /// collection is closed.
        /// </exception>
        public void Clear()
        {
            if (_listener.IsDisposed)
            {
                throw new ObjectDisposedException(_listener.GetType().ToString());
            }

            if (_listener.IsListening)
            {
                EndPointManager.RemoveListener(_listener);
            }

            _prefixes.Clear();
        }
Esempio n. 7
0
        private void close(bool force)
        {
            EndPointManager.RemoveListener(this);

            lock (_ctxRegistrySync) {
                if (!force)
                {
                    sendServiceUnavailable();
                }
            }

            cleanupContextRegistry();
            cleanupConnections();
            cleanupWaitQueue(new ObjectDisposedException(GetType().ToString()));
        }
Esempio n. 8
0
 public void Stop()
 {
     this.CheckDisposed();
     if (this._listening)
     {
         this._listening = false;
         EndPointManager.RemoveListener(this);
         lock (this._ctxRegistrySync)
         {
             this.cleanupContextQueue(true);
         }
         this.cleanupContextRegistry();
         this.cleanupConnections();
         this.cleanupWaitQueue(new HttpListenerException(0x3e3, "The listener is stopped."));
     }
 }
Esempio n. 9
0
 private void close(bool force)
 {
     if (this._listening)
     {
         this._listening = false;
         EndPointManager.RemoveListener(this);
     }
     lock (this._ctxRegistrySync)
     {
         this.cleanupContextQueue(!force);
     }
     this.cleanupContextRegistry();
     this.cleanupConnections();
     this.cleanupWaitQueue(new ObjectDisposedException(base.GetType().ToString()));
     this._disposed = true;
 }
Esempio n. 10
0
        /// <summary>
        /// Stops receiving incoming requests.
        /// </summary>
        /// <exception cref="ObjectDisposedException">
        /// This listener has been closed.
        /// </exception>
        public void Stop()
        {
            CheckDisposed();
            if (!_listening)
            {
                return;
            }

            _listening = false;
            EndPointManager.RemoveListener(this);

            lock (_ctxRegistrySync)
                cleanupContextQueue(true);

            cleanupContextRegistry();
            cleanupConnections();
            cleanupWaitQueue(new HttpListenerException(995, "The listener is stopped."));
        }
Esempio n. 11
0
        private void close(bool force)
        {
            if (_listening)
            {
                _listening = false;

                cleanupContextQueue(force);
                cleanupContextRegistry();

                var name = GetType().ToString();
                var ex   = new ObjectDisposedException(name);
                cleanupWaitQueue(ex);

                EndPointManager.RemoveListener(this);
            }

            _disposed = true;
        }
Esempio n. 12
0
        private void close(bool force)
        {
            if (!_listening)
            {
                _disposed = true;

                return;
            }

            _listening = false;

            cleanupContextQueue(force);
            cleanupContextRegistry();

            var msg = "The listener is closed.";

            cleanupWaitQueue(msg);

            EndPointManager.RemoveListener(this);

            _disposed = true;
        }
Esempio n. 13
0
        private void close(bool force)
        {
            if (!_listening)
            {
                _disposed = true;

                return;
            }

            _listening = false;

            cleanupContextQueue(force);
            cleanupContextRegistry();

            var ex = new ObjectDisposedException(_objectName);

            cleanupWaitQueue(ex);

            EndPointManager.RemoveListener(this);

            _disposed = true;
        }
 public void Stop()
 {
     this.CheckDisposed();
     if (this._listening)
     {
         this._listening = false;
         EndPointManager.RemoveListener(this);
         object obj = this._ctxRegistrySync;
         Monitor.Enter(obj);
         try
         {
             this.cleanupContextQueue(true);
         }
         finally
         {
             Monitor.Exit(obj);
         }
         this.cleanupContextRegistry();
         this.cleanupConnections();
         this.cleanupWaitQueue(new HttpListenerException(995, "The listener is stopped."));
     }
 }
Esempio n. 15
0
 private void close(bool force)
 {
     EndPointManager.RemoveListener(this);
     cleanup(force);
 }
Esempio n. 16
0
 void Close(bool force)
 {
     EndPointManager.RemoveListener(this);
     Cleanup(force);
 }
Esempio n. 17
0
 void Close(bool force)
 {
     CheckDisposed();
     EndPointManager.RemoveListener(this);
     Cleanup(force);
 }