From 603c3deaf141fe7c79a609e02be106a2b3193c7f Mon Sep 17 00:00:00 2001 From: desistud Date: Fri, 6 Mar 2020 14:14:17 -0600 Subject: [PATCH] Update EndPointListener.cs --- src/EmbedIO/Net/Internal/EndPointListener.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/EmbedIO/Net/Internal/EndPointListener.cs b/src/EmbedIO/Net/Internal/EndPointListener.cs index e3af5a938..403d27eca 100644 --- a/src/EmbedIO/Net/Internal/EndPointListener.cs +++ b/src/EmbedIO/Net/Internal/EndPointListener.cs @@ -170,11 +170,19 @@ public void RemovePrefix(ListenerPrefix prefix) do { prefs = _prefixes; - if (!prefs.ContainsKey(prefix)) + ListenerPrefix lpKey = null; + foreach (var p in _prefixes.Keys) + if (p.Path == prefix.Path) + { + lpKey = p; + break; + } + + if (lpKey is null) break; p2 = prefs.ToDictionary(x => x.Key, x => x.Value); - p2.Remove(prefix); + p2.Remove(lpKey); } while (Interlocked.CompareExchange(ref _prefixes, p2, prefs) != prefs); @@ -378,4 +386,4 @@ private void CheckIfRemove() EndPointManager.RemoveEndPoint(this, _endpoint); } } -} \ No newline at end of file +}