[Modify] Polish it

This commit is contained in:
sta 2021-03-31 19:50:37 +09:00
parent 4e5c5f2f66
commit b1fb4a171f

View File

@ -674,11 +674,18 @@ namespace WebSocketSharp.Net
public IAsyncResult BeginGetContext (AsyncCallback callback, Object state)
{
CheckDisposed ();
if (_prefixes.Count == 0)
throw new InvalidOperationException ("The listener has no URI prefix on which listens.");
if (!_listening)
throw new InvalidOperationException ("The listener hasn't been started.");
if (_prefixes.Count == 0) {
var msg = "The listener has no URI prefix on which listens.";
throw new InvalidOperationException (msg);
}
if (!_listening) {
var msg = "The listener has not been started.";
throw new InvalidOperationException (msg);
}
return BeginGetContext (new HttpListenerAsyncResult (callback, state));
}