[Fix] Use try-finally

This commit is contained in:
sta 2017-02-02 17:37:20 +09:00
parent 4f3f165fc0
commit 262922f049

View File

@ -904,10 +904,17 @@ namespace WebSocketSharp.Server
_state = ServerState.ShuttingDown; _state = ServerState.ShuttingDown;
} }
stopReceiving (5000); try {
_services.Stop (code, reason); try {
stopReceiving (5000);
_state = ServerState.Stop; }
finally {
_services.Stop (code, reason);
}
}
finally {
_state = ServerState.Stop;
}
} }
private void stopReceiving (int millisecondsTimeout) private void stopReceiving (int millisecondsTimeout)