Adds an admin chat command to restart relays

This commit is contained in:
Cyberboss
2017-07-05 11:41:43 -04:00
parent 965ca596c4
commit 4c84b8c23c
2 changed files with 21 additions and 2 deletions
+19 -1
View File
@@ -41,7 +41,7 @@ namespace TGServerService
public RootChatCommand()
{
PrintHelpList = true;
Children = new Command[] { new CheckCommand(), new StatusCommand(), new PRsCommand(), new VersionCommand(), new AHelpCommand(), new NameCheckCommand(), new RevisionCommand(), new AdminWhoCommand(), new ByondCommand(), new KekCommand() };
Children = new Command[] { new CheckCommand(), new StatusCommand(), new PRsCommand(), new VersionCommand(), new AHelpCommand(), new NameCheckCommand(), new RevisionCommand(), new AdminWhoCommand(), new ByondCommand(), new KekCommand(), new RelayRestartCommand() };
}
}
class RevisionCommand : ChatCommand
@@ -262,4 +262,22 @@ namespace TGServerService
return "<ckey> <message|ticket <close|resolve|icissue|reject|reopen <ticket #>|list>>";
}
}
class RelayRestartCommand : ChatCommand
{
public RelayRestartCommand()
{
Keyword = "relayrestart";
RequiresAdmin = true;
}
protected override ExitCode Run(IList<string> parameters)
{
Instance.InitInterop();
return ExitCode.Normal;
}
public override string GetHelpText()
{
return "Restart the relay listener. This is a massive hack but it'll do for now";
}
}
}
+2 -1
View File
@@ -167,7 +167,7 @@ namespace TGServerService
}
//Start listening for nudges on the configured port
void InitInterop()
public void InitInterop()
{
lock (NudgeLock)
{
@@ -248,6 +248,7 @@ namespace TGServerService
catch (Exception e)
{
TGServerService.WriteError("Nudge handler thread crashed: " + e.ToString(), TGServerService.EventID.NudgeCrash);
SendMessage("The relay handler crashed, use relayrestart to restore it! Error: " + e.Message, ChatMessageType.AdminInfo);
}
}
}