forked from TrueCloudLab/neoneo-go
Merge pull request #2151 from nspcc-dev/rpc-client-conn
rpc/client: add `MaxConnsPerHost` option, fix #2149
This commit is contained in:
commit
64f9ed826f
1 changed files with 3 additions and 0 deletions
|
@ -50,6 +50,8 @@ type Options struct {
|
||||||
CACert string
|
CACert string
|
||||||
DialTimeout time.Duration
|
DialTimeout time.Duration
|
||||||
RequestTimeout 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.
|
// 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{
|
DialContext: (&net.Dialer{
|
||||||
Timeout: opts.DialTimeout,
|
Timeout: opts.DialTimeout,
|
||||||
}).DialContext,
|
}).DialContext,
|
||||||
|
MaxConnsPerHost: opts.MaxConnsPerHost,
|
||||||
},
|
},
|
||||||
Timeout: opts.RequestTimeout,
|
Timeout: opts.RequestTimeout,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue