Changeset 167 in code for trunk/downstream.go


Ignore:
Timestamp:
Mar 27, 2020, 4:55:03 PM (5 years ago)
Author:
contact
Message:

Add eventDownstreamDisconnected

This should remove the need for protecting user.downstreamConns with a
mutex.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r166 r167  
    309309        if dc.isClosed() {
    310310                return fmt.Errorf("downstream connection already closed")
    311         }
    312 
    313         if u := dc.user; u != nil {
    314                 u.removeDownstream(dc)
    315311        }
    316312
     
    758754                seq := consumer.Close()
    759755
    760                 // TODO: need to take dc.network into account here
    761                 dc.user.lock.Lock()
    762                 lastDownstream := len(dc.user.downstreamConns) == 0
    763                 dc.user.lock.Unlock()
    764 
    765                 if lastDownstream {
    766                         net.lock.Lock()
    767                         net.history[historyName] = seq
    768                         net.lock.Unlock()
    769                 }
     756                net.lock.Lock()
     757                net.history[historyName] = seq
     758                net.lock.Unlock()
    770759        }()
    771760}
Note: See TracChangeset for help on using the changeset viewer.