grpcproxy: fix more issues in watch path

This commit is contained in:
Xiang Li
2016-09-02 14:22:06 -07:00
parent f7293125cf
commit 8cd47c4348
3 changed files with 29 additions and 3 deletions

View File

@ -18,6 +18,8 @@ import (
"sync"
"github.com/coreos/etcd/clientv3"
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"golang.org/x/net/context"
)
@ -38,8 +40,21 @@ func (wgs *watchergroups) addWatcher(rid receiverID, w watcher) {
groups := wgs.groups
if wg, ok := groups[w.wr]; ok {
wg.add(rid, w)
rev := wg.add(rid, w)
wgs.idToGroup[rid] = wg
resp := &pb.WatchResponse{
Header: &pb.ResponseHeader{
// todo: fill in ClusterId
// todo: fill in MemberId:
Revision: rev,
// todo: fill in RaftTerm:
},
WatchId: rid.watcherID,
Created: true,
}
w.ch <- resp
return
}