diff ServerMonitor/Objects/Checks/HttpCheck.cs @ 17:68d7834dc28e

More comments.
author Brad Greco <brad@bgreco.net>
date Sat, 25 May 2019 15:14:26 -0400
parents 453ecc1ed9ea
children b713b9db4c82
line wrap: on
line diff
--- a/ServerMonitor/Objects/Checks/HttpCheck.cs	Tue Apr 30 20:40:58 2019 -0400
+++ b/ServerMonitor/Objects/Checks/HttpCheck.cs	Sat May 25 15:14:26 2019 -0400
@@ -35,6 +35,32 @@
         protected override Task<CheckResult> ExecuteCheckAsync(CancellationToken token)
         {
             throw new NotImplementedException();
+
+
+
+
+            // Cancellable version that doesn't actulaly work
+            // might be useful as a TaskCompletionSource example though
+            //
+            //TaskCompletionSource<CheckResult> tcs = new TaskCompletionSource<CheckResult
+            //
+            //using (Ping ping = new Ping())
+            //{
+            //    token.Register(ping.SendAsyncCancel);
+            //    ping.PingCompleted += (sender, e) =>
+            //    {
+            //        if (e.Error != null)
+            //            tcs.SetResult(Fail("Ping failed: " + e.Error.GetBaseException().Message));
+            //        else if (e.Reply.Status != IPStatus.Success)
+            //            tcs.SetResult(Fail("Ping failed: " + e.Reply.Status.ToString()));
+            //        else
+            //            tcs.SetResult(Pass("Ping completed in " + e.Reply.RoundtripTime + "ms"));
+            //    };
+            //    ping.SendAsync(Server.Host, Timeout, null);
+            //}
+
+            //return tcs.Task;
+
         }
 
         public override string Validate(bool saving = true)