From e9678cee2f457170b71ccb8b72fc8e204d991d09 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 11 Dec 2023 11:38:57 +0100 Subject: [PATCH] downstream: use fresh context to send timeout errors Using an expired context will never actually send the error message here. --- downstream.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/downstream.go b/downstream.go index 57bac33..b4a84ff 100644 --- a/downstream.go +++ b/downstream.go @@ -1690,6 +1690,9 @@ func (dc *downstreamConn) runUntilRegistered() error { go func() { <-ctx.Done() if err := ctx.Err(); err == context.DeadlineExceeded { + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + dc.SendMessage(ctx, &irc.Message{ Prefix: dc.srv.prefix(), Command: "ERROR",