From 9d34547118ca0af15c10e4649f99dc9fe5c40de5 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Thu, 2 Sep 2021 11:25:57 +0300 Subject: [PATCH] rpc/client: add `MaxConnsPerHost` option, fix #2149 Signed-off-by: Evgeniy Stratonikov --- pkg/rpc/client/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/rpc/client/client.go b/pkg/rpc/client/client.go index 9011e680c..d9874f61b 100644 --- a/pkg/rpc/client/client.go +++ b/pkg/rpc/client/client.go @@ -50,6 +50,8 @@ type Options struct { CACert string DialTimeout time.Duration RequestTimeout time.Duration + // Limit total number of connections per host. No limit by default. + MaxConnsPerHost int } // cache stores cache values for the RPC client methods. @@ -86,6 +88,7 @@ func New(ctx context.Context, endpoint string, opts Options) (*Client, error) { DialContext: (&net.Dialer{ Timeout: opts.DialTimeout, }).DialContext, + MaxConnsPerHost: opts.MaxConnsPerHost, }, Timeout: opts.RequestTimeout, }