Add context to upstreamConn.handleCapAck

This commit is contained in:
Simon Ser 2021-12-10 12:28:16 +01:00
parent fe564af756
commit de7d1f7784

View File

@ -540,7 +540,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
caps := strings.Fields(subParams[0]) caps := strings.Fields(subParams[0])
for _, name := range caps { for _, name := range caps {
if err := uc.handleCapAck(strings.ToLower(name), subCmd == "ACK"); err != nil { if err := uc.handleCapAck(ctx, strings.ToLower(name), subCmd == "ACK"); err != nil {
return err return err
} }
} }
@ -1872,7 +1872,7 @@ func (uc *upstreamConn) requestSASL() bool {
return uc.supportsSASL(uc.network.SASL.Mechanism) return uc.supportsSASL(uc.network.SASL.Mechanism)
} }
func (uc *upstreamConn) handleCapAck(name string, ok bool) error { func (uc *upstreamConn) handleCapAck(ctx context.Context, name string, ok bool) error {
uc.caps[name] = ok uc.caps[name] = ok
switch name { switch name {
@ -1897,7 +1897,7 @@ func (uc *upstreamConn) handleCapAck(name string, ok bool) error {
return fmt.Errorf("unsupported SASL mechanism %q", name) return fmt.Errorf("unsupported SASL mechanism %q", name)
} }
uc.SendMessage(context.TODO(), &irc.Message{ uc.SendMessage(ctx, &irc.Message{
Command: "AUTHENTICATE", Command: "AUTHENTICATE",
Params: []string{auth.Mechanism}, Params: []string{auth.Mechanism},
}) })