Replaced the RemoveEndPoint (IPEndPoint, EndPointListener) method with the RemoveEndPoint (EndPointListener) method

This commit is contained in:
sta 2015-02-24 16:56:58 +09:00
parent 9ca8c54e8f
commit 328fd5d43d
2 changed files with 6 additions and 5 deletions

View File

@ -176,7 +176,7 @@ namespace WebSocketSharp.Net
if (_all != null && _all.Count > 0) if (_all != null && _all.Count > 0)
return; return;
EndPointManager.RemoveEndPoint (_endpoint, this); EndPointManager.RemoveEndPoint (this);
} }
private static RSACryptoServiceProvider createRSAFromFile (string filename) private static RSACryptoServiceProvider createRSAFromFile (string filename)

View File

@ -160,13 +160,14 @@ namespace WebSocketSharp.Net
#region Internal Methods #region Internal Methods
internal static void RemoveEndPoint (IPEndPoint endpoint, EndPointListener endpointListener) internal static void RemoveEndPoint (EndPointListener endpointListener)
{ {
lock (((ICollection) _ipToEndpoints).SyncRoot) { lock (((ICollection) _ipToEndpoints).SyncRoot) {
var eps = _ipToEndpoints[endpoint.Address]; var addr = endpointListener.Address;
eps.Remove (endpoint.Port); var eps = _ipToEndpoints[addr];
eps.Remove (endpointListener.Port);
if (eps.Count == 0) if (eps.Count == 0)
_ipToEndpoints.Remove (endpoint.Address); _ipToEndpoints.Remove (addr);
endpointListener.Close (); endpointListener.Close ();
} }