diff options
| author | Michael VanOverbeek <[email protected]> | 2017-04-30 15:37:25 +0000 |
|---|---|---|
| committer | Michael VanOverbeek <[email protected]> | 2017-04-30 15:37:34 +0000 |
| commit | 03d01cdb4de62c1c431aefe9d11f5d276dd21b5a (patch) | |
| tree | c903c4d6dee108ac5a4347e220922083c3888898 /ShiftOS.Server/Program.cs | |
| parent | 12490dec7deaa972cb29166095a7ef0c1f005541 (diff) | |
| download | shiftos_thereturn-03d01cdb4de62c1c431aefe9d11f5d276dd21b5a.tar.gz shiftos_thereturn-03d01cdb4de62c1c431aefe9d11f5d276dd21b5a.tar.bz2 shiftos_thereturn-03d01cdb4de62c1c431aefe9d11f5d276dd21b5a.zip | |
Changes.
Diffstat (limited to 'ShiftOS.Server/Program.cs')
| -rw-r--r-- | ShiftOS.Server/Program.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs index afc2541..9e89e56 100644 --- a/ShiftOS.Server/Program.cs +++ b/ShiftOS.Server/Program.cs @@ -86,7 +86,18 @@ namespace ShiftOS.Server /// <param name="args">The command-line arguments.</param> public static void Main(string[] args) { - + System.Timers.Timer tmr = new System.Timers.Timer(5000); + tmr.Elapsed += (o, a) => + { + if (server.IsOnline) + { + server.DispatchAll(new NetObject("heartbeat", new ServerMessage + { + Name = "heartbeat", + GUID = "server" + })); + } + }; if (!Directory.Exists("saves")) { Directory.CreateDirectory("saves"); @@ -106,11 +117,13 @@ namespace ShiftOS.Server { Console.WriteLine($"Server started on address {server.Address}, port {server.Port}."); ServerStarted?.Invoke(server.Address.ToString()); - }; + tmr.Start(); + }; server.OnStopped += (o, a) => { Console.WriteLine("WARNING! Server stopped."); + tmr.Stop(); }; server.OnError += (o, a) => |
