summaryrefslogtreecommitdiff
path: root/timeoutat/timeoutat.go
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-05-04 10:45:06 -0400
committerWill Hawkins <[email protected]>2022-05-04 10:45:06 -0400
commitfa647c6645f74e3c0e6fded658f5f8b5882b0e01 (patch)
tree1ebcf05ba04fb655fa119a4d9e62dfd8b3261a05 /timeoutat/timeoutat.go
parent3b385cec76f9c23a400cf748d2fba326c456ae3d (diff)
Fully support self-signed certificates (and add debug levels)
Two unrelated changes: 1. Add full support for self-signed HTTPS certificates on the server 2. Add support for multiple log levels: So far we only use one, but adding support for additional levels will help us tier the levels to filter out excessive messages.
Diffstat (limited to 'timeoutat/timeoutat.go')
-rw-r--r--timeoutat/timeoutat.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/timeoutat/timeoutat.go b/timeoutat/timeoutat.go
index 0e13a9f..eac57f2 100644
--- a/timeoutat/timeoutat.go
+++ b/timeoutat/timeoutat.go
@@ -18,17 +18,20 @@ import (
"context"
"fmt"
"time"
+
+ "github.com/network-quality/goresponsiveness/constants"
+ "github.com/network-quality/goresponsiveness/utilities"
)
func TimeoutAt(
ctx context.Context,
when time.Time,
- debug bool,
+ debug constants.DebugLevel,
) (response chan interface{}) {
response = make(chan interface{})
go func(ctx context.Context) {
go func() {
- if debug {
+ if utilities.IsDebug(debug) {
fmt.Printf("Timeout expected to end at %v\n", when)
}
select {
@@ -36,7 +39,7 @@ func TimeoutAt(
case <-ctx.Done():
}
response <- struct{}{}
- if debug {
+ if utilities.IsDebug(debug) {
fmt.Printf("Timeout ended at %v\n", time.Now())
}
}()