Exemplo n.º 1
0
 public void Clear()
 {
     listener.CheckDisposed();
     prefixes.Clear();
     if (listener.IsListening)
     {
         HttpEndPointManager.RemoveListener(_logger, listener);
     }
 }
Exemplo n.º 2
0
        public void Start()
        {
            CheckDisposed();
            if (listening)
            {
                return;
            }

            HttpEndPointManager.AddListener(_logger, this);
            listening = true;
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
 void Close(bool force)
 {
     CheckDisposed();
     HttpEndPointManager.RemoveListener(_logger, this);
     Cleanup(force);
 }