[Modify] Add it
This commit is contained in:
parent
afcfb3334f
commit
8a9125ba3b
@ -58,6 +58,8 @@ namespace WebSocketSharp.Net
|
|||||||
private static readonly Dictionary<IPAddress, Dictionary<int, EndPointListener>>
|
private static readonly Dictionary<IPAddress, Dictionary<int, EndPointListener>>
|
||||||
_addressToEndpoints;
|
_addressToEndpoints;
|
||||||
|
|
||||||
|
private static readonly Dictionary<IPEndPoint, EndPointListener> _endpoints;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Static Constructor
|
#region Static Constructor
|
||||||
@ -65,6 +67,7 @@ namespace WebSocketSharp.Net
|
|||||||
static EndPointManager ()
|
static EndPointManager ()
|
||||||
{
|
{
|
||||||
_addressToEndpoints = new Dictionary<IPAddress, Dictionary<int, EndPointListener>> ();
|
_addressToEndpoints = new Dictionary<IPAddress, Dictionary<int, EndPointListener>> ();
|
||||||
|
_endpoints = new Dictionary<IPEndPoint, EndPointListener> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -186,6 +189,20 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
#region Internal Methods
|
#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)
|
internal static bool RemoveEndPoint (IPAddress address, int port)
|
||||||
{
|
{
|
||||||
lock (((ICollection) _addressToEndpoints).SyncRoot) {
|
lock (((ICollection) _addressToEndpoints).SyncRoot) {
|
||||||
|
Loading…
Reference in New Issue
Block a user