public void Clear()
 {
     listener.CheckDisposed();
     prefixes.Clear();
     if (listener.IsListening)
     {
         HttpEndPointManager.RemoveListener(_logger, listener);
     }
 }
Beispiel #2
0
        public void Start()
        {
            CheckDisposed();
            if (listening)
            {
                return;
            }

            HttpEndPointManager.AddListener(_logger, this);
            listening = true;
        }
        public void Add(string uriPrefix)
        {
            listener.CheckDisposed();
            //ListenerPrefix.CheckUri(uriPrefix);
            if (prefixes.Contains(uriPrefix))
            {
                return;
            }

            prefixes.Add(uriPrefix);
            if (listener.IsListening)
            {
                HttpEndPointManager.AddPrefix(_logger, uriPrefix, listener);
            }
        }
        public bool Remove(string uriPrefix)
        {
            listener.CheckDisposed();
            if (uriPrefix == null)
            {
                throw new ArgumentNullException("uriPrefix");
            }

            bool result = prefixes.Remove(uriPrefix);

            if (result && listener.IsListening)
            {
                HttpEndPointManager.RemovePrefix(_logger, uriPrefix, listener);
            }

            return(result);
        }
        public void AddRange(IEnumerable <string> uriPrefixes)
        {
            _listener.CheckDisposed();

            foreach (var uriPrefix in uriPrefixes)
            {
                if (_prefixes.Contains(uriPrefix))
                {
                    continue;
                }

                _prefixes.Add(uriPrefix);
                if (_listener.IsListening)
                {
                    HttpEndPointManager.AddPrefix(_logger, uriPrefix, _listener);
                }
            }
        }
Beispiel #6
0
        private void CheckIfRemove()
        {
            if (_prefixes.Count > 0)
            {
                return;
            }

            List <ListenerPrefix> list = _unhandledPrefixes;

            if (list != null && list.Count > 0)
            {
                return;
            }

            list = _allPrefixes;
            if (list != null && list.Count > 0)
            {
                return;
            }

            HttpEndPointManager.RemoveEndPoint(this, _endpoint);
        }
Beispiel #7
0
 void Close(bool force)
 {
     CheckDisposed();
     HttpEndPointManager.RemoveListener(_logger, this);
     Cleanup(force);
 }