Make IO Buffer size configurable. (#1544)

* Make IO Buffer size configurable.

* Fixing typo
This commit is contained in:
mmukhi
2017-09-28 14:11:14 -07:00
committed by GitHub
parent 6014154b60
commit 8214c28a62
8 changed files with 72 additions and 9 deletions

View File

@ -100,6 +100,22 @@ const (
// DialOption configures how we set up the connection.
type DialOption func(*dialOptions)
// WithWriteBufferSize lets you set the size of write buffer, this determines how much data can be batched
// before doing a write on the wire.
func WithWriteBufferSize(s int) DialOption {
return func(o *dialOptions) {
o.copts.WriteBufferSize = s
}
}
// WithReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most
// for each read syscall.
func WithReadBufferSize(s int) DialOption {
return func(o *dialOptions) {
o.copts.ReadBufferSize = s
}
}
// WithInitialWindowSize returns a DialOption which sets the value for initial window size on a stream.
// The lower bound for window size is 64K and any value smaller than that will be ignored.
func WithInitialWindowSize(s int32) DialOption {