downstream: use fresh context to send timeout errors

Using an expired context will never actually send the error message
here.
This commit is contained in:
Simon Ser 2023-12-11 11:38:57 +01:00
parent 6729297159
commit e9678cee2f

View File

@ -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",