[Modify] Polish it

This commit is contained in:
sta 2021-03-28 22:00:53 +09:00
parent 206f1f4730
commit 054e3ef03e

View File

@ -765,11 +765,18 @@ namespace WebSocketSharp.Net
public HttpListenerContext GetContext ()
{
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);
}
var ares = BeginGetContext (new HttpListenerAsyncResult (null, null));
ares.InGet = true;