[Modify] Do not throw

This commit is contained in:
sta 2022-01-06 21:10:20 +09:00
parent b5d62e06cd
commit 06edc3beae

View File

@ -1012,31 +1012,24 @@ namespace WebSocketSharp.Server
_state = ServerState.ShuttingDown; _state = ServerState.ShuttingDown;
} }
try {
var threw = false;
try { try {
_services.Stop (code, reason); _services.Stop (code, reason);
} }
catch { catch (Exception ex) {
threw = true; _log.Fatal (ex.Message);
_log.Debug (ex.ToString ());
throw;
} }
finally {
try { try {
stopReceiving (5000); stopReceiving (5000);
} }
catch { catch (Exception ex) {
if (!threw) _log.Fatal (ex.Message);
throw; _log.Debug (ex.ToString ());
} }
}
}
finally {
_state = ServerState.Stop; _state = ServerState.Stop;
} }
}
private void stopReceiving (int millisecondsTimeout) private void stopReceiving (int millisecondsTimeout)
{ {