/// <inheritdoc /> public void Start() { if (IsListening) { return; } EndPointManager.AddListener(this).GetAwaiter().GetResult(); IsListening = true; }
/// <summary> /// Starts this listener. /// </summary> public void Start() { if (IsListening) { return; } EndPointManager.AddListener(this); IsListening = true; }
/// <summary> /// Starts this listener. /// </summary> public void Start() { CheckDisposed(); if (IsListening) { return; } EndPointManager.AddListener(this); IsListening = true; }
public new void Add(string uriPrefix) { ListenerPrefix.CheckUri(uriPrefix); if (Contains(uriPrefix)) { return; } base.Add(uriPrefix); if (_listener.IsListening) { EndPointManager.AddPrefix(uriPrefix, _listener).GetAwaiter().GetResult(); } }
/// <summary> /// Adds the specified URI prefix. /// </summary> /// <param name="uriPrefix">The URI prefix.</param> public void Add(string uriPrefix) { ListenerPrefix.CheckUri(uriPrefix); if (_prefixes.Contains(uriPrefix)) { return; } _prefixes.Add(uriPrefix); if (_listener.IsListening) { EndPointManager.AddPrefix(uriPrefix, _listener); } }
/// <summary> /// Removes the specified URI prefix. /// </summary> /// <param name="uriPrefix">The URI prefix.</param> /// <returns>True if "uriPrefix" was removed; otherwise, false</returns> /// <exception cref="System.ArgumentNullException">uriPrefix</exception> public new bool Remove(string uriPrefix) { if (uriPrefix == null) { throw new ArgumentNullException(nameof(uriPrefix)); } var result = base.Remove(uriPrefix); if (result && _listener.IsListening) { EndPointManager.RemovePrefix(uriPrefix, _listener); } return(result); }
/// <summary> /// Removes the specified URI prefix. /// </summary> /// <param name="uriPrefix">The URI prefix.</param> /// <returns>True if "uriPrefix" was removed; otherwise, false</returns> /// <exception cref="System.ArgumentNullException">uriPrefix</exception> public bool Remove(string uriPrefix) { _listener.CheckDisposed(); if (uriPrefix == null) { throw new ArgumentNullException(nameof(uriPrefix)); } var result = _prefixes.Remove(uriPrefix); if (result && _listener.IsListening) { EndPointManager.RemovePrefix(uriPrefix, _listener); } return(result); }
private void CheckIfRemove() { if (_prefixes.Count > 0) { return; } var list = _unhandled; if (list != null && list.Count > 0) { return; } list = _all; if (list != null && list.Count > 0) { return; } EndPointManager.RemoveEndPoint(this, _endpoint); }
private void Close(bool closeExisting) { EndPointManager.RemoveListener(this); var conns = new List <HttpConnection>(); lock (_connections.SyncRoot) { var keys = _connections.Keys; var connsArray = new HttpConnection[keys.Count]; keys.CopyTo(connsArray, 0); _connections.Clear(); conns.AddRange(connsArray); } for (var i = conns.Count - 1; i >= 0; i--) { conns[i].Close(true); } if (closeExisting == false) { return; } while (_ctxQueue.IsEmpty == false) { foreach (var key in _ctxQueue.Keys.Select(x => x).ToList()) { if (_ctxQueue.TryGetValue(key, out var context)) { context.Connection.Close(true); } } } }
private async Task CloseAsync(bool force) { CheckDisposed(); EndPointManager.RemoveListener(this); await CleanupAsync(force); }
void Close(bool force) { CheckDisposed(); EndPointManager.RemoveListener(this); Cleanup(force); }