diff options
| author | Michael VanOverbeek <[email protected]> | 2017-03-07 14:17:58 +0000 |
|---|---|---|
| committer | Michael VanOverbeek <[email protected]> | 2017-03-07 14:18:03 +0000 |
| commit | 9c143b1249e03fa63492c7aa5283bf60f88c118b (patch) | |
| tree | c4f5aeca7c0f6e5ff417854d5f6aef3f0999b67b /ShiftOS.Server/Program.cs | |
| parent | a28a68bcf8ef5e1e9d7d049d8d25515f43d5407f (diff) | |
| download | shiftos_thereturn-9c143b1249e03fa63492c7aa5283bf60f88c118b.tar.gz shiftos_thereturn-9c143b1249e03fa63492c7aa5283bf60f88c118b.tar.bz2 shiftos_thereturn-9c143b1249e03fa63492c7aa5283bf60f88c118b.zip | |
auto crash handling
Diffstat (limited to 'ShiftOS.Server/Program.cs')
| -rw-r--r-- | ShiftOS.Server/Program.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs index 7e5a517..9093c35 100644 --- a/ShiftOS.Server/Program.cs +++ b/ShiftOS.Server/Program.cs @@ -123,6 +123,27 @@ namespace ShiftOS.Server Console.WriteLine("Client connected."); server.DispatchTo(a.Guid, new NetObject("welcome", new ServerMessage { Name = "Welcome", Contents = a.Guid.ToString(), GUID = "Server" })); }; + + server.OnClientDisconnected += (o, a) => + { + Console.WriteLine("Client disconnected."); + }; + + server.OnClientRejected += (o, a) => + { + Console.WriteLine("FUCK. Something HORRIBLE JUST HAPPENED."); + }; + + AppDomain.CurrentDomain.UnhandledException += (o, a) => + { + ChatBackend.Broadcast("**Automatic Broadcast:** The multi-user domain is restarting because of a crash."); +#if DEBUG + ChatBackend.Broadcast("Crash summary: " + a.ExceptionObject.ToString()); +#endif + if(server.IsOnline == true) + server.Stop(); + System.Diagnostics.Process.Start("ShiftOS.Server.exe"); + }; server.OnReceived += (o, a) => { |
