Esempio n. 1
0
        void Cleanup(bool aborting, TimeSpan timeout)
        {
            using (LockHelper.TakeWriterLock(this.listenerRWLock))
            {
                HttpListener listenerSnapshot = this.listener;
                if (listenerSnapshot == null)
                {
                    return;
                }

                try
                {
                    listenerSnapshot.Stop();
                }
                finally
                {
                    try
                    {
                        listenerSnapshot.Close();
                    }
                    finally
                    {
                        if (!aborting)
                        {
                            base.OnClose(timeout);
                        }
                        else
                        {
                            base.OnAbort();
                        }
                    }
                }

                this.listener = null;
            }
        }