Changeset 179 in code for trunk/upstream.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/upstream.go

    r178 r179  
    6464
    6565        // set of LIST commands in progress, per downstream
    66         // access is synchronized with user.pendingLISTsLock
    6766        pendingLISTDownstreamSet map[uint64]struct{}
    6867
     
    152151        }
    153152        close(uc.closed)
    154         for _, log := range uc.logs {
    155                 log.file.Close()
    156         }
    157         uc.endPendingLists(true)
    158153        return nil
    159154}
     
    193188
    194189func (uc *upstreamConn) getPendingList() *pendingLIST {
    195         uc.user.pendingLISTsLock.Lock()
    196         defer uc.user.pendingLISTsLock.Unlock()
    197190        for _, pl := range uc.user.pendingLISTs {
    198191                if _, ok := pl.pendingCommands[uc.network.ID]; !ok {
     
    206199func (uc *upstreamConn) endPendingLists(all bool) (found bool) {
    207200        found = false
    208         uc.user.pendingLISTsLock.Lock()
    209         defer uc.user.pendingLISTsLock.Unlock()
    210201        for i := 0; i < len(uc.user.pendingLISTs); i++ {
    211202                pl := uc.user.pendingLISTs[i]
Note: See TracChangeset for help on using the changeset viewer.