public void RemovePrefix(ListenerPrefix prefix, HttpListener listener) { if (prefix.Host == "*") { List <ListenerPrefix> list; List <ListenerPrefix> list2; do { list = this._unhandled; list2 = ((list == null) ? new List <ListenerPrefix>() : new List <ListenerPrefix>(list)); if (!EndPointListener.removeSpecial(list2, prefix)) { break; } }while (Interlocked.CompareExchange <List <ListenerPrefix> >(ref this._unhandled, list2, list) != list); this.checkIfRemove(); return; } if (prefix.Host == "+") { List <ListenerPrefix> list; List <ListenerPrefix> list2; do { list = this._all; list2 = ((list == null) ? new List <ListenerPrefix>() : new List <ListenerPrefix>(list)); if (!EndPointListener.removeSpecial(list2, prefix)) { break; } }while (Interlocked.CompareExchange <List <ListenerPrefix> >(ref this._all, list2, list) != list); this.checkIfRemove(); return; } Dictionary <ListenerPrefix, HttpListener> prefixes; Dictionary <ListenerPrefix, HttpListener> dictionary; do { prefixes = this._prefixes; if (!prefixes.ContainsKey(prefix)) { break; } dictionary = new Dictionary <ListenerPrefix, HttpListener>(prefixes); dictionary.Remove(prefix); }while (Interlocked.CompareExchange <Dictionary <ListenerPrefix, HttpListener> >(ref this._prefixes, dictionary, prefixes) != prefixes); this.checkIfRemove(); }
public void RemovePrefix(HttpListenerPrefix prefix, WebSocketSharp.Net.HttpListener listener) { List <HttpListenerPrefix> httpListenerPrefixes; List <HttpListenerPrefix> httpListenerPrefixes1; Dictionary <HttpListenerPrefix, WebSocketSharp.Net.HttpListener> httpListenerPrefixes2; Dictionary <HttpListenerPrefix, WebSocketSharp.Net.HttpListener> httpListenerPrefixes3; if (prefix.Host == "*") { do { httpListenerPrefixes = this._unhandled; if (httpListenerPrefixes != null) { httpListenerPrefixes1 = new List <HttpListenerPrefix>(httpListenerPrefixes); if (EndPointListener.removeSpecial(httpListenerPrefixes1, prefix)) { continue; } break; } else { break; } }while (Interlocked.CompareExchange <List <HttpListenerPrefix> >(ref this._unhandled, httpListenerPrefixes1, httpListenerPrefixes) != httpListenerPrefixes); this.leaveIfNoPrefix(); } else if (prefix.Host != "+") { do { httpListenerPrefixes2 = this._prefixes; if (httpListenerPrefixes2.ContainsKey(prefix)) { httpListenerPrefixes3 = new Dictionary <HttpListenerPrefix, WebSocketSharp.Net.HttpListener>(httpListenerPrefixes2); httpListenerPrefixes3.Remove(prefix); } else { break; } }while (Interlocked.CompareExchange <Dictionary <HttpListenerPrefix, WebSocketSharp.Net.HttpListener> >(ref this._prefixes, httpListenerPrefixes3, httpListenerPrefixes2) != httpListenerPrefixes2); this.leaveIfNoPrefix(); } else { do { httpListenerPrefixes = this._all; if (httpListenerPrefixes != null) { httpListenerPrefixes1 = new List <HttpListenerPrefix>(httpListenerPrefixes); if (EndPointListener.removeSpecial(httpListenerPrefixes1, prefix)) { continue; } break; } else { break; } }while (Interlocked.CompareExchange <List <HttpListenerPrefix> >(ref this._all, httpListenerPrefixes1, httpListenerPrefixes) != httpListenerPrefixes); this.leaveIfNoPrefix(); } }