From 8a9125ba3b393e1b7bbf05ecc587e4eec2b7c8ff Mon Sep 17 00:00:00 2001 From: sta Date: Sun, 26 Jun 2016 16:16:32 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Net/EndPointManager.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/websocket-sharp/Net/EndPointManager.cs b/websocket-sharp/Net/EndPointManager.cs index c61e476f..f2fe9ec8 100644 --- a/websocket-sharp/Net/EndPointManager.cs +++ b/websocket-sharp/Net/EndPointManager.cs @@ -58,6 +58,8 @@ namespace WebSocketSharp.Net private static readonly Dictionary> _addressToEndpoints; + private static readonly Dictionary _endpoints; + #endregion #region Static Constructor @@ -65,6 +67,7 @@ namespace WebSocketSharp.Net static EndPointManager () { _addressToEndpoints = new Dictionary> (); + _endpoints = new Dictionary (); } #endregion @@ -186,6 +189,20 @@ namespace WebSocketSharp.Net #region Internal Methods + internal static bool RemoveEndPoint (IPEndPoint endpoint) + { + lock (((ICollection) _endpoints).SyncRoot) { + EndPointListener lsnr; + if (!_endpoints.TryGetValue (endpoint, out lsnr)) + return false; + + _endpoints.Remove (endpoint); + lsnr.Close (); + + return true; + } + } + internal static bool RemoveEndPoint (IPAddress address, int port) { lock (((ICollection) _addressToEndpoints).SyncRoot) {