Changeset 131 in code for trunk


Ignore:
Timestamp:
Mar 20, 2020, 9:48:17 PM (5 years ago)
Author:
contact
Message:

Move upstreamConn.history to network

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r130 r131  
    709709                var seqPtr *uint64
    710710                if firstDownstream {
    711                         uc.lock.Lock()
    712                         seq, ok := uc.history[historyName]
    713                         uc.lock.Unlock()
     711                        uc.network.lock.Lock()
     712                        seq, ok := uc.network.history[historyName]
     713                        uc.network.lock.Unlock()
    714714                        if ok {
    715715                                seqPtr = &seq
     
    739739
    740740                        if lastDownstream {
    741                                 uc.lock.Lock()
    742                                 uc.history[historyName] = seq
    743                                 uc.lock.Unlock()
     741                                uc.network.lock.Lock()
     742                                uc.network.history[historyName] = seq
     743                                uc.network.lock.Unlock()
    744744                        }
    745745                }()
  • trunk/upstream.go

    r129 r131  
    99        "strconv"
    1010        "strings"
    11         "sync"
    1211        "time"
    1312
     
    5453        saslClient  sasl.Client
    5554        saslStarted bool
    56 
    57         lock    sync.Mutex
    58         history map[string]uint64 // TODO: move to network
    5955}
    6056
     
    8682                ring:     NewRing(network.user.srv.RingCap),
    8783                channels: make(map[string]*upstreamChannel),
    88                 history:  make(map[string]uint64),
    8984                caps:     make(map[string]string),
    9085        }
  • trunk/user.go

    r120 r131  
    2121        Network
    2222        user *user
    23         conn *upstreamConn
     23
     24        lock    sync.Mutex
     25        conn    *upstreamConn
     26        history map[string]uint64
    2427}
    2528
     
    2831                Network: *record,
    2932                user:    user,
     33                history: make(map[string]uint64),
    3034        }
    3135}
     
    4953                uc.register()
    5054
    51                 net.user.lock.Lock()
     55                net.lock.Lock()
    5256                net.conn = uc
    53                 net.user.lock.Unlock()
     57                net.lock.Unlock()
    5458
    5559                if err := uc.readMessages(net.user.upstreamIncoming); err != nil {
     
    5862                uc.Close()
    5963
    60                 net.user.lock.Lock()
     64                net.lock.Lock()
    6165                net.conn = nil
    62                 net.user.lock.Unlock()
     66                net.lock.Unlock()
    6367        }
    6468}
     
    96100        u.lock.Lock()
    97101        for _, network := range u.networks {
     102                network.lock.Lock()
    98103                uc := network.conn
     104                network.lock.Unlock()
     105
    99106                if uc == nil || !uc.registered || uc.closed {
    100107                        continue
Note: See TracChangeset for help on using the changeset viewer.