# HG changeset patch # User Brad Greco # Date 1559512538 14400 # Node ID 437442cd8090f8b2ae811c13ee5e4d7251190e36 # Parent e59ec1585616f12448b73d0484712660df4097f4 Fix checks still running after a server is deleted and checks not running immediately after a server is created. diff -r e59ec1585616 -r 437442cd8090 ServerMonitor/Objects/ServerMonitor.cs --- a/ServerMonitor/Objects/ServerMonitor.cs Sun Jun 02 17:51:30 2019 -0400 +++ b/ServerMonitor/Objects/ServerMonitor.cs Sun Jun 02 17:55:38 2019 -0400 @@ -67,6 +67,8 @@ { Servers.Add(server); SaveServers(); + server.CheckModified += Server_CheckModified; + server.EnabledChanged += Server_EnabledChanged; } /// Deletes a server from the server monitor. @@ -74,6 +76,12 @@ public void DeleteServer(Server server) { Servers.Remove(server); + // Cancel all queued and executing checks belonging to a + // server that was deleted. + foreach (Check check in server.Checks) + { + CancelCheck(check); + } SaveServers(); }