[Modify] Add it

This commit is contained in:
sta 2017-06-03 16:09:05 +09:00
parent 4e208b7033
commit e420a1b733

View File

@ -800,6 +800,43 @@ namespace WebSocketSharp.Server
abort (); abort ();
} }
private void start ()
{
if (_state == ServerState.Start) {
_log.Info ("The server has already started.");
return;
}
if (_state == ServerState.ShuttingDown) {
_log.Warn ("The server is shutting down.");
return;
}
lock (_sync) {
if (_state == ServerState.Start) {
_log.Info ("The server has already started.");
return;
}
if (_state == ServerState.ShuttingDown) {
_log.Warn ("The server is shutting down.");
return;
}
_services.Start ();
try {
startReceiving ();
}
catch {
_services.Stop (1011, String.Empty);
throw;
}
_state = ServerState.Start;
}
}
private void startReceiving () private void startReceiving ()
{ {
_listener.Start (); _listener.Start ();