Changeset 179 in code for trunk/user.go


Ignore:
Timestamp:
Mar 27, 2020, 11:51:58 PM (5 years ago)
Author:
contact
Message:

Introduce eventUpstreamDisconnected

This allows us to perform cleanup actions in the user goroutine. This
removes the need for pendingLISTsLock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user.go

    r177 r179  
    1313        msg *irc.Message
    1414        uc  *upstreamConn
     15}
     16
     17type eventUpstreamDisconnected struct {
     18        uc *upstreamConn
    1519}
    1620
     
    7680                }
    7781                uc.Close()
     82                net.user.events <- eventUpstreamDisconnected{uc}
    7883
    7984                net.lock.Lock()
     
    99104
    100105        // LIST commands in progress
    101         pendingLISTsLock sync.Mutex
    102         pendingLISTs     []pendingLIST
     106        pendingLISTs []pendingLIST
    103107}
    104108
     
    164168        for e := range u.events {
    165169                switch e := e.(type) {
     170                case eventUpstreamDisconnected:
     171                        uc := e.uc
     172                        for _, log := range uc.logs {
     173                                log.file.Close()
     174                        }
     175                        uc.endPendingLists(true)
    166176                case eventUpstreamMessage:
    167177                        msg, uc := e.msg, e.uc
Note: See TracChangeset for help on using the changeset viewer.