Skip to content

Commit fb56d7b

Browse files
committed
[Modify] Add it
1 parent 731db0f commit fb56d7b

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

websocket-sharp/Server/WebSocketServer.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,45 @@ private void receiveRequest ()
863863
abort ();
864864
}
865865

866+
private void start (ServerSslConfiguration sslConfig)
867+
{
868+
if (_state == ServerState.Start) {
869+
_logger.Info ("The server has already started.");
870+
return;
871+
}
872+
873+
if (_state == ServerState.ShuttingDown) {
874+
_logger.Warn ("The server is shutting down.");
875+
return;
876+
}
877+
878+
lock (_sync) {
879+
if (_state == ServerState.Start) {
880+
_logger.Info ("The server has already started.");
881+
return;
882+
}
883+
884+
if (_state == ServerState.ShuttingDown) {
885+
_logger.Warn ("The server is shutting down.");
886+
return;
887+
}
888+
889+
_sslConfigInUse = sslConfig;
890+
_realmInUse = getRealm ();
891+
892+
_services.Start ();
893+
try {
894+
startReceiving ();
895+
}
896+
catch {
897+
_services.Stop (1011, String.Empty);
898+
throw;
899+
}
900+
901+
_state = ServerState.Start;
902+
}
903+
}
904+
866905
private void startReceiving ()
867906
{
868907
if (_reuseAddress) {

0 commit comments

Comments
 (0)