Check context cancellation in handleServiceServerNotice
This prevents this function from blocking forever if it exceeds the deadline.
This commit is contained in:
parent
802e82c272
commit
22f9ce1b86
11
service.go
11
service.go
@ -1046,8 +1046,13 @@ func handleServiceServerNotice(ctx context.Context, dc *downstreamConn, params [
|
|||||||
Command: "NOTICE",
|
Command: "NOTICE",
|
||||||
Params: []string{"$" + dc.srv.Hostname, text},
|
Params: []string{"$" + dc.srv.Hostname, text},
|
||||||
}
|
}
|
||||||
|
var err error
|
||||||
dc.srv.forEachUser(func(u *user) {
|
dc.srv.forEachUser(func(u *user) {
|
||||||
u.events <- eventBroadcast{broadcastMsg}
|
select {
|
||||||
})
|
case <-ctx.Done():
|
||||||
return nil
|
err = ctx.Err()
|
||||||
|
case u.events <- eventBroadcast{broadcastMsg}:
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user