X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FSystem.Net%2FEndPointManager.cs;h=33c5940b43210f7a982cbc788fe15331fcf2e486;hb=7b3d84254a4f4a48b1f3ff40b6c8fdc10f0863c8;hp=b3919d4258d3ab633bea6a09b01dbca10cbff0e1;hpb=0443306d611d0830e27327e1f0a3ef3457dfa535;p=mono.git diff --git a/mcs/class/System/System.Net/EndPointManager.cs b/mcs/class/System/System.Net/EndPointManager.cs index b3919d4258d..33c5940b432 100644 --- a/mcs/class/System/System.Net/EndPointManager.cs +++ b/mcs/class/System/System.Net/EndPointManager.cs @@ -25,14 +25,16 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if NET_2_0 + +#if NET_2_0 && SECURITY_DEP + using System.Collections; using System.Collections.Generic; namespace System.Net { sealed class EndPointManager { - static Dictionary> ip_to_endpoints = - new Dictionary> (); + // Dictionary> + static Hashtable ip_to_endpoints = new Hashtable (); private EndPointManager () { @@ -40,7 +42,7 @@ namespace System.Net { public static void AddListener (HttpListener listener) { - List added = new List (); + ArrayList added = new ArrayList (); try { lock (ip_to_endpoints) { foreach (string prefix in listener.Prefixes) { @@ -50,7 +52,7 @@ namespace System.Net { } } catch { foreach (string prefix in added) { - RemovePrefixInternal (prefix, listener); + RemovePrefix (prefix, listener); } throw; } @@ -79,17 +81,17 @@ namespace System.Net { static EndPointListener GetEPListener (IPAddress addr, int port, HttpListener listener, bool secure) { - Dictionary p = null; + Hashtable p = null; // Dictionary if (ip_to_endpoints.ContainsKey (addr)) { - p = ip_to_endpoints [addr]; + p = (Hashtable) ip_to_endpoints [addr]; } else { - p = new Dictionary (); + p = new Hashtable (); ip_to_endpoints [addr] = p; } EndPointListener epl = null; if (p.ContainsKey (port)) { - epl = p [port]; + epl = (EndPointListener) p [port]; } else { epl = new EndPointListener (addr, port, secure); p [port] = epl; @@ -101,9 +103,13 @@ namespace System.Net { public static void RemoveEndPoint (EndPointListener epl, IPEndPoint ep) { lock (ip_to_endpoints) { - Dictionary p = null; - p = ip_to_endpoints [ep.Address]; + // Dictionary p + Hashtable p = null; + p = (Hashtable) ip_to_endpoints [ep.Address]; p.Remove (ep.Port); + if (p.Count == 0) { + ip_to_endpoints.Remove (ep.Address); + } epl.Close (); } }