From 1b4f7d8a686bbd07701f403941cbc1f28fdf832c Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Tue, 17 Jul 2018 16:32:35 -0700 Subject: [PATCH] a stream should not timeout --- 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 f529af32..a342d2ce 100644 --- a/client/rpc_client.go +++ b/client/rpc_client.go @@ -159,7 +159,15 @@ func (r *rpcClient) stream(ctx context.Context, address string, req Request, opt return nil, errors.InternalServerError("go.micro.client", err.Error()) } - c, err := r.opts.Transport.Dial(address, transport.WithStream(), transport.WithTimeout(opts.DialTimeout)) + dOpts := []transport.DialOption{ + transport.WithStream(), + } + + if opts.DialTimeout >= 0 { + dOpts = append(dOpts, transport.WithTimeout(opts.DialTimeout)) + } + + c, err := r.opts.Transport.Dial(address, dOpts...) if err != nil { return nil, errors.InternalServerError("go.micro.client", "connection error: %v", err) }