[Fix] Move them

This commit is contained in:
sta 2016-04-13 14:22:13 +09:00
parent 9317a7e6b8
commit 228ea17262

View File

@ -555,13 +555,6 @@ namespace WebSocketSharp.Net
internal HttpListenerAsyncResult BeginGetContext (HttpListenerAsyncResult asyncResult) 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 early to avoid race conditions.
lock (_ctxRegistrySync) { lock (_ctxRegistrySync) {
if (!_listening) if (!_listening)
@ -690,6 +683,13 @@ namespace WebSocketSharp.Net
/// </exception> /// </exception>
public IAsyncResult BeginGetContext (AsyncCallback callback, Object state) 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)); return BeginGetContext (new HttpListenerAsyncResult (callback, state));
} }
@ -774,6 +774,13 @@ namespace WebSocketSharp.Net
/// </exception> /// </exception>
public HttpListenerContext GetContext () 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)); var ares = BeginGetContext (new HttpListenerAsyncResult (null, null));
ares.InGet = true; ares.InGet = true;