upstream: pass context to upstreamConn.requestCaps

This commit is contained in:
Simon Ser 2022-04-04 13:43:00 +02:00
parent 5de2a7ec12
commit fb20cff45b

View File

@ -526,7 +526,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
break // wait to receive all capabilities break // wait to receive all capabilities
} }
uc.requestCaps() uc.requestCaps(ctx)
if uc.requestSASL() { if uc.requestSASL() {
break // we'll send CAP END after authentication is completed break // we'll send CAP END after authentication is completed
@ -558,7 +558,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
return newNeedMoreParamsError(msg.Command) return newNeedMoreParamsError(msg.Command)
} }
uc.handleSupportedCaps(subParams[0]) uc.handleSupportedCaps(subParams[0])
uc.requestCaps() uc.requestCaps(ctx)
case "DEL": case "DEL":
if len(subParams) < 1 { if len(subParams) < 1 {
return newNeedMoreParamsError(msg.Command) return newNeedMoreParamsError(msg.Command)
@ -1846,7 +1846,7 @@ func (uc *upstreamConn) handleSupportedCaps(capsStr string) {
} }
} }
func (uc *upstreamConn) requestCaps() { func (uc *upstreamConn) requestCaps(ctx context.Context) {
var requestCaps []string var requestCaps []string
for c := range permanentUpstreamCaps { for c := range permanentUpstreamCaps {
if uc.caps.IsAvailable(c) && !uc.caps.IsEnabled(c) { if uc.caps.IsAvailable(c) && !uc.caps.IsEnabled(c) {
@ -1858,7 +1858,7 @@ func (uc *upstreamConn) requestCaps() {
return return
} }
uc.SendMessage(context.TODO(), &irc.Message{ uc.SendMessage(ctx, &irc.Message{
Command: "CAP", Command: "CAP",
Params: []string{"REQ", strings.Join(requestCaps, " ")}, Params: []string{"REQ", strings.Join(requestCaps, " ")},
}) })