From 52d9d75dfa840af6ae8079e8805d753b3cfd6a33 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Sat, 31 Aug 2019 18:26:48 +0100 Subject: [PATCH] use with stream for client connection --- client/rpc_client.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/rpc_client.go b/client/rpc_client.go index 754e4329..2fe51934 100644 --- a/client/rpc_client.go +++ b/client/rpc_client.go @@ -96,7 +96,15 @@ func (r *rpcClient) call(ctx context.Context, node *registry.Node, req Request, } } - c, err := r.pool.Get(address, transport.WithTimeout(opts.DialTimeout)) + dOpts := []transport.DialOption{ + transport.WithStream(), + } + + if opts.DialTimeout >= 0 { + dOpts = append(dOpts, transport.WithTimeout(opts.DialTimeout)) + } + + c, err := r.pool.Get(address, dOpts...) if err != nil { return errors.InternalServerError("go.micro.client", "connection error: %v", err) }