Changeset 40 in code for trunk/server.go


Ignore:
Timestamp:
Feb 7, 2020, 10:56:36 AM (5 years ago)
Author:
contact
Message:

Add user.forEachDownstream

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server.go

    r39 r40  
    3636        srv      *Server
    3737
    38         lock          sync.Mutex
    39         upstreamConns []*upstreamConn
     38        lock            sync.Mutex
     39        upstreamConns   []*upstreamConn
     40        downstreamConns []*downstreamConn
    4041}
    4142
     
    4748                }
    4849                f(uc)
     50        }
     51        u.lock.Unlock()
     52}
     53
     54func (u *user) forEachDownstream(f func(dc *downstreamConn)) {
     55        u.lock.Lock()
     56        for _, dc := range u.downstreamConns {
     57                f(dc)
    4958        }
    5059        u.lock.Unlock()
Note: See TracChangeset for help on using the changeset viewer.