From 228ea172629c4420e64c7489b470c095553fc530 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 13 Apr 2016 14:22:13 +0900 Subject: [PATCH] [Fix] Move them --- websocket-sharp/Net/HttpListener.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/websocket-sharp/Net/HttpListener.cs b/websocket-sharp/Net/HttpListener.cs index 2c5857b5..010fda62 100644 --- a/websocket-sharp/Net/HttpListener.cs +++ b/websocket-sharp/Net/HttpListener.cs @@ -555,13 +555,6 @@ namespace WebSocketSharp.Net internal HttpListenerAsyncResult BeginGetContext (HttpListenerAsyncResult asyncResult) { - 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."); - // Lock _ctxRegistrySync early to avoid race conditions. lock (_ctxRegistrySync) { if (!_listening) @@ -690,6 +683,13 @@ 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."); + return BeginGetContext (new HttpListenerAsyncResult (callback, state)); } @@ -774,6 +774,13 @@ 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."); + var ares = BeginGetContext (new HttpListenerAsyncResult (null, null)); ares.InGet = true;