Channel rather than mutex to check is closed

This commit is contained in:
Asim
2015-12-28 19:11:10 +00:00
parent 10d2ad0de9
commit bffd55f500
2 changed files with 23 additions and 8 deletions

View File

@@ -136,9 +136,12 @@ func (r *rpcClient) stream(ctx context.Context, address string, req Request) (St
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error sending request: %v", err))
}
var once sync.Once
stream := &rpcStream{
context: ctx,
request: req,
once: once,
closed: make(chan bool),
codec: newRpcPlusCodec(msg, c, cf),
}