[Modify] Polish it

This commit is contained in:
sta 2021-08-05 21:57:09 +09:00
parent d05afaeea1
commit 6b8b0ba745

View File

@ -1053,24 +1053,6 @@ namespace WebSocketSharp.Server
private void stop (ushort code, string reason) private void stop (ushort code, string reason)
{ {
if (_state == ServerState.Ready) {
_log.Info ("The server is not started.");
return;
}
if (_state == ServerState.ShuttingDown) {
_log.Info ("The server is shutting down.");
return;
}
if (_state == ServerState.Stop) {
_log.Info ("The server has already stopped.");
return;
}
lock (_sync) { lock (_sync) {
if (_state == ServerState.ShuttingDown) { if (_state == ServerState.ShuttingDown) {
_log.Info ("The server is shutting down."); _log.Info ("The server is shutting down.");
@ -1477,6 +1459,24 @@ namespace WebSocketSharp.Server
/// </summary> /// </summary>
public void Stop () public void Stop ()
{ {
if (_state == ServerState.Ready) {
_log.Info ("The server is not started.");
return;
}
if (_state == ServerState.ShuttingDown) {
_log.Info ("The server is shutting down.");
return;
}
if (_state == ServerState.Stop) {
_log.Info ("The server has already stopped.");
return;
}
stop (1001, String.Empty); stop (1001, String.Empty);
} }