diff --git a/client/rpc_stream.go b/client/rpc_stream.go index 7c880d88..426aafc4 100644 --- a/client/rpc_stream.go +++ b/client/rpc_stream.go @@ -130,15 +130,15 @@ func (r *rpcStream) Error() error { } func (r *rpcStream) Close() error { - r.RLock() + r.Lock() select { case <-r.closed: - r.RUnlock() + r.Unlock() return nil default: close(r.closed) - r.RUnlock() + r.Unlock() // send the end of stream message if r.sendEOS {