Changeset 702 in code for trunk/downstream.go


Ignore:
Timestamp:
Nov 17, 2021, 11:38:08 AM (4 years ago)
Author:
contact
Message:

Lift up context to downstreamConn.handleMessage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r701 r702  
    616616
    617617func (dc *downstreamConn) handleMessage(msg *irc.Message) error {
     618        ctx, cancel := context.WithTimeout(context.TODO(), handleDownstreamMessageTimeout)
     619        defer cancel()
     620
    618621        switch msg.Command {
    619622        case "QUIT":
     
    621624        default:
    622625                if dc.registered {
    623                         return dc.handleMessageRegistered(msg)
     626                        return dc.handleMessageRegistered(ctx, msg)
    624627                } else {
    625                         return dc.handleMessageUnregistered(msg)
    626                 }
    627         }
    628 }
    629 
    630 func (dc *downstreamConn) handleMessageUnregistered(msg *irc.Message) error {
    631         ctx, cancel := context.WithTimeout(context.TODO(), handleDownstreamMessageTimeout)
    632         defer cancel()
    633 
     628                        return dc.handleMessageUnregistered(ctx, msg)
     629                }
     630        }
     631}
     632
     633func (dc *downstreamConn) handleMessageUnregistered(ctx context.Context, msg *irc.Message) error {
    634634        switch msg.Command {
    635635        case "NICK":
     
    14171417}
    14181418
    1419 func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
    1420         ctx, cancel := context.WithTimeout(context.TODO(), handleDownstreamMessageTimeout)
    1421         defer cancel()
    1422 
     1419func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.Message) error {
    14231420        switch msg.Command {
    14241421        case "CAP":
Note: See TracChangeset for help on using the changeset viewer.