Changeset 103 in code for trunk/upstream.go


Ignore:
Timestamp:
Mar 16, 2020, 11:44:59 AM (5 years ago)
Author:
contact
Message:

Per-user dispatcher goroutine

This allows message handlers to read upstream/downstream connection
information without causing any race condition.

References: https://todo.sr.ht/~emersion/soju/1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r102 r103  
    660660}
    661661
    662 func (uc *upstreamConn) readMessages() error {
     662func (uc *upstreamConn) readMessages(ch chan<- upstreamIncomingMessage) error {
    663663        for {
    664664                msg, err := uc.irc.ReadMessage()
     
    673673                }
    674674
    675                 if err := uc.handleMessage(msg); err != nil {
    676                         uc.logger.Printf("failed to handle message %q: %v", msg, err)
    677                 }
     675                ch <- upstreamIncomingMessage{msg, uc}
    678676        }
    679677
Note: See TracChangeset for help on using the changeset viewer.