Fix a few for EndPointManager.cs

This commit is contained in:
sta 2014-05-01 13:27:29 +09:00
parent 47940eb179
commit 8461d24f9d

View File

@ -67,7 +67,7 @@ namespace WebSocketSharp.Net
{ {
var prefix = new ListenerPrefix (uriPrefix); var prefix = new ListenerPrefix (uriPrefix);
if (prefix.Path.IndexOf ('%') != -1) if (prefix.Path.IndexOf ('%') != -1)
throw new HttpListenerException (400, "Invalid path."); throw new HttpListenerException (400, "Invalid path."); // TODO: Code?
if (prefix.Path.IndexOf ("//", StringComparison.Ordinal) != -1) if (prefix.Path.IndexOf ("//", StringComparison.Ordinal) != -1)
throw new HttpListenerException (400, "Invalid path."); // TODO: Code? throw new HttpListenerException (400, "Invalid path."); // TODO: Code?
@ -149,10 +149,9 @@ namespace WebSocketSharp.Net
public static void AddPrefix (string uriPrefix, HttpListener httpListener) public static void AddPrefix (string uriPrefix, HttpListener httpListener)
{ {
lock (((ICollection) _ipToEndpoints).SyncRoot) { lock (((ICollection) _ipToEndpoints).SyncRoot)
addPrefix (uriPrefix, httpListener); addPrefix (uriPrefix, httpListener);
} }
}
public static void RemoveEndPoint (EndPointListener epListener, IPEndPoint endpoint) public static void RemoveEndPoint (EndPointListener epListener, IPEndPoint endpoint)
{ {
@ -168,18 +167,16 @@ namespace WebSocketSharp.Net
public static void RemoveListener (HttpListener httpListener) public static void RemoveListener (HttpListener httpListener)
{ {
lock (((ICollection) _ipToEndpoints).SyncRoot) { lock (((ICollection) _ipToEndpoints).SyncRoot)
foreach (var prefix in httpListener.Prefixes) foreach (var prefix in httpListener.Prefixes)
removePrefix (prefix, httpListener); removePrefix (prefix, httpListener);
} }
}
public static void RemovePrefix (string uriPrefix, HttpListener httpListener) public static void RemovePrefix (string uriPrefix, HttpListener httpListener)
{ {
lock (((ICollection) _ipToEndpoints).SyncRoot) { lock (((ICollection) _ipToEndpoints).SyncRoot)
removePrefix (uriPrefix, httpListener); removePrefix (uriPrefix, httpListener);
} }
}
#endregion #endregion
} }