Added the internal Ext.CheckIfCanStart (ServerState) method

This commit is contained in:
sta 2015-08-12 17:24:53 +09:00
parent 7bd0fb87f2
commit 46eae139e2
3 changed files with 9 additions and 2 deletions

View File

@ -238,6 +238,13 @@ namespace WebSocketSharp
: null;
}
internal static string CheckIfCanStart (this ServerState state)
{
return state == ServerState.Start || state == ServerState.ShuttingDown
? "This operation has already been done."
: null;
}
internal static string CheckIfStart (this ServerState state)
{
return state == ServerState.Ready

View File

@ -892,7 +892,7 @@ namespace WebSocketSharp.Server
public void Start ()
{
lock (_sync) {
var msg = _state.CheckIfStartable () ?? checkIfCertificateExists ();
var msg = _state.CheckIfCanStart () ?? checkIfCertificateExists ();
if (msg != null) {
_logger.Error (msg);
return;

View File

@ -795,7 +795,7 @@ namespace WebSocketSharp.Server
public void Start ()
{
lock (_sync) {
var msg = _state.CheckIfStartable () ?? checkIfCertificateExists ();
var msg = _state.CheckIfCanStart () ?? checkIfCertificateExists ();
if (msg != null) {
_logger.Error (msg);
return;