Refactored a few for HttpListenerPrefixCollection.cs

This commit is contained in:
sta 2015-03-02 16:48:16 +09:00
parent 1118674782
commit fa1a572453

View File

@ -131,7 +131,6 @@ namespace WebSocketSharp.Net
{ {
_listener.CheckDisposed (); _listener.CheckDisposed ();
HttpListenerPrefix.CheckPrefix (uriPrefix); HttpListenerPrefix.CheckPrefix (uriPrefix);
if (_prefixes.Contains (uriPrefix)) if (_prefixes.Contains (uriPrefix))
return; return;
@ -149,7 +148,6 @@ namespace WebSocketSharp.Net
public void Clear () public void Clear ()
{ {
_listener.CheckDisposed (); _listener.CheckDisposed ();
_prefixes.Clear (); _prefixes.Clear ();
if (_listener.IsListening) if (_listener.IsListening)
EndPointManager.RemoveListener (_listener); EndPointManager.RemoveListener (_listener);
@ -253,11 +251,11 @@ namespace WebSocketSharp.Net
if (uriPrefix == null) if (uriPrefix == null)
throw new ArgumentNullException ("uriPrefix"); throw new ArgumentNullException ("uriPrefix");
var res = _prefixes.Remove (uriPrefix); var ret = _prefixes.Remove (uriPrefix);
if (res && _listener.IsListening) if (ret && _listener.IsListening)
EndPointManager.RemovePrefix (uriPrefix, _listener); EndPointManager.RemovePrefix (uriPrefix, _listener);
return res; return ret;
} }
#endregion #endregion