[Modify] Polish it

This commit is contained in:
sta 2016-04-12 13:44:52 +09:00
parent 0d92f1205d
commit 82ea089683

View File

@ -454,7 +454,10 @@ namespace WebSocketSharp.Net
private void close (bool force) private void close (bool force)
{ {
if (_listening) {
_listening = false;
EndPointManager.RemoveListener (this); EndPointManager.RemoveListener (this);
}
lock (_ctxRegistrySync) { lock (_ctxRegistrySync) {
if (!force) if (!force)
@ -464,6 +467,8 @@ namespace WebSocketSharp.Net
cleanupContextRegistry (); cleanupContextRegistry ();
cleanupConnections (); cleanupConnections ();
cleanupWaitQueue (new ObjectDisposedException (GetType ().ToString ())); cleanupWaitQueue (new ObjectDisposedException (GetType ().ToString ()));
_disposed = true;
} }
private HttpListenerContext getContextFromQueue () private HttpListenerContext getContextFromQueue ()
@ -648,14 +653,9 @@ namespace WebSocketSharp.Net
if (_disposed) if (_disposed)
return; return;
if (_listening) {
_listening = false;
close (true); close (true);
} }
_disposed = true;
}
/// <summary> /// <summary>
/// Begins getting an incoming request asynchronously. /// Begins getting an incoming request asynchronously.
/// </summary> /// </summary>
@ -701,14 +701,9 @@ namespace WebSocketSharp.Net
if (_disposed) if (_disposed)
return; return;
if (_listening) {
_listening = false;
close (false); close (false);
} }
_disposed = true;
}
/// <summary> /// <summary>
/// Ends an asynchronous operation to get an incoming request. /// Ends an asynchronous operation to get an incoming request.
/// </summary> /// </summary>
@ -836,14 +831,9 @@ namespace WebSocketSharp.Net
if (_disposed) if (_disposed)
return; return;
if (_listening) {
_listening = false;
close (true); close (true);
} }
_disposed = true;
}
#endregion #endregion
} }
} }