Skip to content

Commit

Permalink
Update EndPointListener.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
desistud authored and rdeago committed Mar 7, 2020
1 parent 2210619 commit 603c3de
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/EmbedIO/Net/Internal/EndPointListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -378,4 +386,4 @@ private void CheckIfRemove()
EndPointManager.RemoveEndPoint(this, _endpoint);
}
}
}
}

0 comments on commit 603c3de

Please sign in to comment.