clientv3: fix race on writing watch channel over return channel

Found in TestElectionFailover
This commit is contained in:
Anthony Romano 2016-03-27 03:39:21 -07:00
parent 5ee85bea7c
commit 4bdfc0a46d

View File

@ -240,11 +240,11 @@ func (w *watcher) addStream(resp *pb.WatchResponse, pendingReq *watchRequest) {
w.streams[ws.id] = ws
w.mu.Unlock()
// send messages to subscriber
go w.serveStream(ws)
// pass back the subscriber channel for the watcher
pendingReq.retc <- ret
// send messages to subscriber
go w.serveStream(ws)
}
// closeStream closes the watcher resources and removes it