comparison 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
comparison
equal deleted inserted replaced
16:7626b099aefd 17:68d7834dc28e
33 public bool ResponseBodyUseRegex { get; set; } 33 public bool ResponseBodyUseRegex { get; set; }
34 34
35 protected override Task<CheckResult> ExecuteCheckAsync(CancellationToken token) 35 protected override Task<CheckResult> ExecuteCheckAsync(CancellationToken token)
36 { 36 {
37 throw new NotImplementedException(); 37 throw new NotImplementedException();
38
39
40
41
42 // Cancellable version that doesn't actulaly work
43 // might be useful as a TaskCompletionSource example though
44 //
45 //TaskCompletionSource<CheckResult> tcs = new TaskCompletionSource<CheckResult
46 //
47 //using (Ping ping = new Ping())
48 //{
49 // token.Register(ping.SendAsyncCancel);
50 // ping.PingCompleted += (sender, e) =>
51 // {
52 // if (e.Error != null)
53 // tcs.SetResult(Fail("Ping failed: " + e.Error.GetBaseException().Message));
54 // else if (e.Reply.Status != IPStatus.Success)
55 // tcs.SetResult(Fail("Ping failed: " + e.Reply.Status.ToString()));
56 // else
57 // tcs.SetResult(Pass("Ping completed in " + e.Reply.RoundtripTime + "ms"));
58 // };
59 // ping.SendAsync(Server.Host, Timeout, null);
60 //}
61
62 //return tcs.Task;
63
38 } 64 }
39 65
40 public override string Validate(bool saving = true) 66 public override string Validate(bool saving = true)
41 { 67 {
42 string message = base.Validate(); 68 string message = base.Validate();