Protect upstreamConn.history with a lock
This commit is contained in:
parent
af76c3868a
commit
1241bf82aa
@ -555,7 +555,9 @@ func (dc *downstreamConn) register() error {
|
||||
|
||||
var seqPtr *uint64
|
||||
if firstDownstream {
|
||||
uc.lock.Lock()
|
||||
seq, ok := uc.history[historyName]
|
||||
uc.lock.Unlock()
|
||||
if ok {
|
||||
seqPtr = &seq
|
||||
}
|
||||
@ -583,7 +585,9 @@ func (dc *downstreamConn) register() error {
|
||||
dc.user.lock.Unlock()
|
||||
|
||||
if lastDownstream {
|
||||
uc.lock.Lock()
|
||||
uc.history[historyName] = seq
|
||||
uc.lock.Unlock()
|
||||
}
|
||||
}()
|
||||
})
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/emersion/go-sasl"
|
||||
@ -48,11 +49,13 @@ type upstreamConn struct {
|
||||
closed bool
|
||||
modes modeSet
|
||||
channels map[string]*upstreamChannel
|
||||
history map[string]uint64
|
||||
caps map[string]string
|
||||
|
||||
saslClient sasl.Client
|
||||
saslStarted bool
|
||||
|
||||
lock sync.Mutex
|
||||
history map[string]uint64 // TODO: move to network
|
||||
}
|
||||
|
||||
func connectToUpstream(network *network) (*upstreamConn, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user