From 0f7cbe570115e71d60d70439c4d641e2c2d32281 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Tue, 2 Mar 2021 21:54:35 +0100 Subject: [PATCH] Replace use of os.ErrTimeout by our own value. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ErrTimeout was introduced in Go 1.15, while we support 1.13 and later. Thanks to Michael Ströder for the report. --- ice/ice.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ice/ice.go b/ice/ice.go index 47b4e94..da0eb30 100644 --- a/ice/ice.go +++ b/ice/ice.go @@ -18,6 +18,18 @@ import ( "github.com/jech/galene/turnserver" ) +type timeoutError struct{} + +func (e timeoutError) Error() string { + return "timeout" +} + +func (e timeoutError) Timeout() bool { + return true +} + +var errTimeout = timeoutError{} + type Server struct { URLs []string `json:"urls"` Username string `json:"username,omitempty"` @@ -235,6 +247,6 @@ func RelayTest(timeout time.Duration) (time.Duration, error) { } return time.Now().Sub(tm), nil case <-timer.C: - return 0, os.ErrDeadlineExceeded + return 0, errTimeout } }