backoff: make DefaultBackoffConfig a concrete value
To enforce immutability of the `DefaultBackoffConfig`, we've made it a concrete value. While fields can still be set directly on the value, taking a copy will not incidentally pull a reference to the variable. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
@ -118,7 +118,7 @@ func WithPicker(p Picker) DialOption {
|
||||
// WithBackoffMaxDelay configures the dialer to use the provided maximum delay
|
||||
// when backing off after failed connection attempts.
|
||||
func WithBackoffMaxDelay(md time.Duration) DialOption {
|
||||
return WithBackoffConfig(&BackoffConfig{MaxDelay: md})
|
||||
return WithBackoffConfig(BackoffConfig{MaxDelay: md})
|
||||
}
|
||||
|
||||
// WithBackoffConfig configures the dialer to use the provided backoff
|
||||
@ -126,7 +126,7 @@ func WithBackoffMaxDelay(md time.Duration) DialOption {
|
||||
//
|
||||
// Use WithBackoffMaxDelay until more parameters on BackoffConfig are opened up
|
||||
// for use.
|
||||
func WithBackoffConfig(b *BackoffConfig) DialOption {
|
||||
func WithBackoffConfig(b BackoffConfig) DialOption {
|
||||
// Set defaults to ensure that provided BackoffConfig is valid and
|
||||
// unexported fields get default values.
|
||||
b.setDefaults()
|
||||
|
||||
Reference in New Issue
Block a user