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:
parent
6729297159
commit
e9678cee2f
@ -1690,6 +1690,9 @@ func (dc *downstreamConn) runUntilRegistered() error {
|
|||||||
go func() {
|
go func() {
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
if err := ctx.Err(); err == context.DeadlineExceeded {
|
if err := ctx.Err(); err == context.DeadlineExceeded {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
dc.SendMessage(ctx, &irc.Message{
|
dc.SendMessage(ctx, &irc.Message{
|
||||||
Prefix: dc.srv.prefix(),
|
Prefix: dc.srv.prefix(),
|
||||||
Command: "ERROR",
|
Command: "ERROR",
|
||||||
|
Loading…
Reference in New Issue
Block a user