예제 #1
0
        internal static void RemoveEndPoint(EndPointListener epl, IPEndPoint ep)
        {
            if (IPToEndpoints.TryGetValue(ep.Address, out var p))
            {
                if (p.TryRemove(ep.Port, out _) && p.Count == 0)
                {
                    IPToEndpoints.TryRemove(ep.Address, out _);
                }
            }

            epl.Close();
        }
예제 #2
0
        public static void RemoveEndPoint(EndPointListener epl, IPEndPoint ep)
        {
            lock (IPToEndpoints)
            {
                var p = IPToEndpoints[ep.Address];
                p.Remove(ep.Port);
                if (p.Count == 0)
                {
                    IPToEndpoints.Remove(ep.Address);
                }
            }

            epl.Close();
        }
예제 #3
0
 public static void RemoveEndPoint(EndPointListener epl, IPEndPoint ep)
 {
     lock (_ipToEndpoints)
     {
         // Dictionary<int, EndPointListener> p
         Hashtable p = null;
         p = (Hashtable)_ipToEndpoints[ep.Address];
         p.Remove(ep.Port);
         if (p.Count == 0)
         {
             _ipToEndpoints.Remove(ep.Address);
         }
         epl.Close();
     }
 }