mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
proxy/grpcproxy: Add critical section to protect wps.watchers and wps.nextWatcherID
This commit is contained in:
parent
9a2af7378a
commit
a0b2c6ad4b
@ -240,6 +240,7 @@ func (wps *watchProxyStream) recvLoop() error {
|
||||
continue
|
||||
}
|
||||
|
||||
wps.mu.Lock()
|
||||
w := &watcher{
|
||||
wr: watchRange{string(cr.Key), string(cr.RangeEnd)},
|
||||
id: wps.nextWatcherID,
|
||||
@ -258,6 +259,7 @@ func (wps *watchProxyStream) recvLoop() error {
|
||||
w.nextrev = cr.StartRevision
|
||||
wps.watchers[w.id] = w
|
||||
wps.ranges.add(w)
|
||||
wps.mu.Unlock()
|
||||
case *pb.WatchRequest_CancelRequest:
|
||||
wps.delete(uv.CancelRequest.WatchId)
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user