Changeset 739 in code


Ignore:
Timestamp:
Dec 2, 2021, 10:27:12 PM (4 years ago)
Author:
contact
Message:

Add context to upstreamConn.handleMessage

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r738 r739  
    413413}
    414414
    415 func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
     415func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) error {
    416416        var label string
    417417        if l, ok := msg.GetTag("label"); ok {
     
    492492                        if ch != nil && msg.Command != "TAGMSG" {
    493493                                if ch.Detached {
    494                                         uc.handleDetachedMessage(ch, msg)
     494                                        uc.handleDetachedMessage(ctx, ch, msg)
    495495                                }
    496496
     
    663663                if dc, _ := uc.dequeueCommand("AUTHENTICATE"); dc != nil && dc.sasl != nil {
    664664                        if msg.Command == irc.RPL_SASLSUCCESS {
    665                                 uc.network.autoSaveSASLPlain(context.TODO(), dc.sasl.plainUsername, dc.sasl.plainPassword)
     665                                uc.network.autoSaveSASLPlain(ctx, dc.sasl.plainUsername, dc.sasl.plainPassword)
    666666                        }
    667667
     
    685685                                        return err
    686686                                }
    687                                 uc.network.autoSaveSASLPlain(context.TODO(), account, password)
     687                                uc.network.autoSaveSASLPlain(ctx, account, password)
    688688                        }
    689689
     
    17161716}
    17171717
    1718 func (uc *upstreamConn) handleDetachedMessage(ch *Channel, msg *irc.Message) {
     1718func (uc *upstreamConn) handleDetachedMessage(ctx context.Context, ch *Channel, msg *irc.Message) {
    17191719        if uc.network.detachedMessageNeedsRelay(ch, msg) {
    17201720                uc.forEachDownstream(func(dc *downstreamConn) {
     
    17241724        if ch.ReattachOn == FilterMessage || (ch.ReattachOn == FilterHighlight && uc.network.isHighlight(msg)) {
    17251725                uc.network.attach(ch)
    1726                 if err := uc.srv.db.StoreChannel(context.TODO(), uc.network.ID, ch); err != nil {
     1726                if err := uc.srv.db.StoreChannel(ctx, uc.network.ID, ch); err != nil {
    17271727                        uc.logger.Printf("failed to update channel %q: %v", ch.Name, err)
    17281728                }
     
    19151915                }
    19161916
    1917                 if err := uc.handleMessage(msg); err != nil {
     1917                if err := uc.handleMessage(context.TODO(), msg); err != nil {
    19181918                        if _, ok := err.(registrationError); ok {
    19191919                                return err
  • trunk/user.go

    r738 r739  
    612612                                break
    613613                        }
    614                         if err := uc.handleMessage(msg); err != nil {
     614                        if err := uc.handleMessage(context.TODO(), msg); err != nil {
    615615                                uc.logger.Printf("failed to handle message %q: %v", msg, err)
    616616                        }
Note: See TracChangeset for help on using the changeset viewer.