Fix saving and reading daemon config
This commit is contained in:
parent
b05cce4fd7
commit
ec0c46a3a8
@ -12,7 +12,6 @@ namespace MelonVPNCore
|
||||
{
|
||||
private static Process currentVpnProcess;
|
||||
private static bool shouldBeRunning;
|
||||
private static bool shouldRestart;
|
||||
private static bool isRestarting;
|
||||
private const int startingTime = 3000;
|
||||
private const int restartDelay = 250;
|
||||
@ -63,14 +62,14 @@ namespace MelonVPNCore
|
||||
}
|
||||
else if (data == Messages.RestartOnMsg)
|
||||
{
|
||||
shouldRestart = true;
|
||||
Console.WriteLine("Updated shouldRestart to true");
|
||||
config.ShouldRestart = true;
|
||||
SaveConfig();
|
||||
Client.SendDataMessage(DataMessage.RestartOn, true);
|
||||
}
|
||||
else if (data == Messages.RestartOffMsg)
|
||||
{
|
||||
shouldRestart = false;
|
||||
Console.WriteLine("Updated shouldRestart to false");
|
||||
config.ShouldRestart = false;
|
||||
SaveConfig();
|
||||
Client.SendDataMessage(DataMessage.RestartOff, true);
|
||||
@ -99,7 +98,7 @@ namespace MelonVPNCore
|
||||
Client.SendDataMessage(DataMessage.Offline, true);
|
||||
Client.SendCustomMessage(Messages.ClientListEmptyMsg, true);
|
||||
}
|
||||
Client.SendDataMessage((shouldRestart) ? DataMessage.RestartOn : DataMessage.RestartOff);
|
||||
Client.SendDataMessage(config.ShouldRestart ? DataMessage.RestartOn : DataMessage.RestartOff);
|
||||
}
|
||||
else if (data == Messages.StartMsg)
|
||||
{
|
||||
@ -198,7 +197,7 @@ namespace MelonVPNCore
|
||||
Thread.Sleep(restartDelay);
|
||||
bool imonline = false;
|
||||
isRestarting = true;
|
||||
while (shouldRestart && shouldBeRunning)
|
||||
while (config.ShouldRestart && shouldBeRunning)
|
||||
{
|
||||
Console.WriteLine("Sending restarting reply");
|
||||
Client.SendDataMessage(DataMessage.Restarting, true);
|
||||
|
Loading…
Reference in New Issue
Block a user