mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #10974 from lzhfromustc/watchers
proxy: Add critical section to protect wps.watchers and wps.nextWatcherID
This commit is contained in:
commit
bbb379fa4a
@ -241,6 +241,7 @@ func (wps *watchProxyStream) recvLoop() error {
|
||||
continue
|
||||
}
|
||||
|
||||
wps.mu.Lock()
|
||||
w := &watcher{
|
||||
wr: watchRange{string(cr.Key), string(cr.RangeEnd)},
|
||||
id: wps.nextWatcherID,
|
||||
@ -259,6 +260,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