Skip to content

Commit

Permalink
adding new settings under dialoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
janardhankrishna-sai committed Jan 8, 2025
1 parent 136cc82 commit 05ad4cc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions dialoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ type dialOptions struct {
idleTimeout time.Duration
defaultScheme string
maxCallAttempts int
staticConnWindowSize int32
staticStreamWindowSize int32
}

// DialOption configures how we set up the connection.
Expand Down Expand Up @@ -662,6 +664,32 @@ func WithDisableHealthCheck() DialOption {
})
}

// WithStaticConnWindowSize returns a DialOption which sets a static value for
// the connection window size. This disables BDP estimation and keeps the
// window size fixed at the provided value. The lower bound for window size is
// 64K, and any value smaller than that will be ignored.
func WithStaticConnWindowSize(s int32) DialOption {
return newFuncDialOption(func(o *dialOptions) {
if s < 64*1024 {
return
}
o.staticConnWindowSize = s
})
}

// WithStaticStreamWindowSize returns a DialOption which sets a static value for
// the stream window size. This disables BDP estimation and keeps the
// window size fixed at the provided value. The lower bound for window size is
// 64K, and any value smaller than that will be ignored.
func WithStaticStreamWindowSize(s int32) DialOption {
return newFuncDialOption(func(o *dialOptions) {
if s < 64*1024 {
return
}
o.staticStreamWindowSize = s
})
}

func defaultDialOptions() dialOptions {
return dialOptions{
copts: transport.ConnectOptions{
Expand Down

0 comments on commit 05ad4cc

Please sign in to comment.