File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -45,21 +45,26 @@ func (c *commonRPC) Context() context.Context {
45
45
// Wait waits for the RPC to finish (remote end closed the stream).
46
46
func (c * commonRPC ) Wait (ctx context.Context ) error {
47
47
for {
48
- var dataClosed bool
49
48
var err error
50
49
var waitCh <- chan struct {}
50
+ var rpcCtx context.Context
51
51
c .bcast .HoldLock (func (broadcast func (), getWaitCh func () <- chan struct {}) {
52
- dataClosed , err = c .dataClosed , c .remoteErr
52
+ rpcCtx , err = c .ctx , c .remoteErr
53
53
waitCh = getWaitCh ()
54
54
})
55
55
56
- if dataClosed {
56
+ if err != nil {
57
57
return err
58
58
}
59
+ if rpcCtx .Err () != nil {
60
+ // rpc must have ended w/o an error being set
61
+ return context .Canceled
62
+ }
59
63
60
64
select {
61
65
case <- ctx .Done ():
62
66
return context .Canceled
67
+ case <- rpcCtx .Done ():
63
68
case <- waitCh :
64
69
}
65
70
}
You can’t perform that action at this time.
0 commit comments