Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.6 #39

Merged
merged 2 commits into from
Oct 23, 2015
Merged

V1.6 #39

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Management/Server/Command/RESTART.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using SuperSocket.SocketBase.Protocol;
using SuperSocket.WebSocket.SubProtocol;
using SuperSocket.SocketBase.Metadata;
using System.Threading;

namespace SuperSocket.ServerManager.Command
{
Expand Down Expand Up @@ -44,9 +45,22 @@ protected override void ExecuteAsyncJsonCommand(ManagementSession session, strin
return;
}

if(server.State != SocketBase.ServerState.Running)
{
SendJsonMessage(session, token,
new CommandResult
{
Result = false,
Message = string.Format("The server instance \"{0}\" cannot restart now", commandInfo)
});
return;
}

server.Stop();

while (server.State != SocketBase.ServerState.NotStarted)
{
Thread.Sleep(10);
//Wating for stop
//TODO:Timeout
}
Expand Down
11 changes: 11 additions & 0 deletions Management/Server/Command/START.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ protected override void ExecuteAsyncJsonCommand(ManagementSession session, strin
return;
}

if(server.State != SocketBase.ServerState.NotStarted)
{
SendJsonMessage(session, token,
new CommandResult
{
Result = false,
Message = string.Format("The server instance \"{0}\" is working", commandInfo)
});
return;
}

if (server.Start())
{
var nodeStatus = session.AppServer.CurrentNodeStatus;
Expand Down
11 changes: 11 additions & 0 deletions Management/Server/Command/STOP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ protected override void ExecuteAsyncJsonCommand(ManagementSession session, strin
return;
}

if(server.State != SocketBase.ServerState.Running)
{
SendJsonMessage(session, token,
new CommandResult
{
Result = false,
Message = string.Format("The server instance \"{0}\" cannot stop now", commandInfo)
});
return;
}

server.Stop();

var nodeStatus = session.AppServer.CurrentNodeStatus;
Expand Down