Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions dialoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,31 @@ func WithReadBufferSize(s int) DialOption {

// 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.
// smaller than that will be ignored. This does not disable dynamic flow control.
//
// Deprecated: use WithInitialStreamWindowSize instead. Will be supported
// throughout 1.x.
func WithInitialWindowSize(s int32) DialOption {
return WithInitialStreamWindowSize(s)
}

// WithInitialStreamWindowSize returns a DialOption that 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. This does not disable dynamic
// flow control.
func WithInitialStreamWindowSize(s int32) DialOption {
return newFuncDialOption(func(o *dialOptions) {
o.copts.InitialWindowSize = s
o.copts.StaticWindowSize = true
})
}

// WithInitialConnWindowSize returns a DialOption which sets the value for
// initial window size on a connection. The lower bound for window size is 64K
// and any value smaller than that will be ignored.
// and any value smaller than that will be ignored. This does not disable
// dynamic flow control.
func WithInitialConnWindowSize(s int32) DialOption {
return newFuncDialOption(func(o *dialOptions) {
o.copts.InitialConnWindowSize = s
o.copts.StaticWindowSize = true
})
}

Expand Down
20 changes: 15 additions & 5 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,30 @@ func ReadBufferSize(s int) ServerOption {
}

// InitialWindowSize returns a ServerOption that sets window size for stream.
// The lower bound for window size is 64K and any value smaller than that will be ignored.
// The lower bound for window size is 64K and any value smaller than that will
// be ignored. This does not disable dynamic flow control.
//
// Deprecated: use InitialStreamWindowSize instead. Will be supported
// throughout 1.x.
func InitialWindowSize(s int32) ServerOption {
return InitialStreamWindowSize(s)
}

// InitialStreamWindowSize returns a ServerOption that sets window size for
// stream. The lower bound for window size is 64K and any value smaller than
// that will be ignored. This does not disable dynamic flow control.
func InitialStreamWindowSize(s int32) ServerOption {
return newFuncServerOption(func(o *serverOptions) {
o.initialWindowSize = s
o.staticWindowSize = true
})
}

// InitialConnWindowSize returns a ServerOption that sets window size for a connection.
// The lower bound for window size is 64K and any value smaller than that will be ignored.
// InitialConnWindowSize returns a ServerOption that sets window size for a
// connection. The lower bound for window size is 64K and any value smaller than
// that will be ignored. This does not disable dynamic flow control.
func InitialConnWindowSize(s int32) ServerOption {
return newFuncServerOption(func(o *serverOptions) {
o.initialConnWindowSize = s
o.staticWindowSize = true
})
}

Expand Down
9 changes: 5 additions & 4 deletions test/end2end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,10 @@ func (te *test) listenAndServe(ts testgrpc.TestServiceServer, listen func(networ
sopts = append(sopts, grpc.UnknownServiceHandler(te.unknownHandler))
}
if te.serverInitialWindowSize > 0 {
sopts = append(sopts, grpc.InitialWindowSize(te.serverInitialWindowSize))
sopts = append(sopts, grpc.StaticStreamWindowSize(te.serverInitialWindowSize))
}
if te.serverInitialConnWindowSize > 0 {
sopts = append(sopts, grpc.InitialConnWindowSize(te.serverInitialConnWindowSize))
sopts = append(sopts, grpc.StaticConnWindowSize(te.serverInitialConnWindowSize))
}
la := ":0"
if te.e.network == "unix" {
Expand Down Expand Up @@ -818,10 +818,10 @@ func (te *test) configDial(opts ...grpc.DialOption) ([]grpc.DialOption, string)
opts = append(opts, grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingConfig": [{"%s":{}}]}`, te.e.balancer)))
}
if te.clientInitialWindowSize > 0 {
opts = append(opts, grpc.WithInitialWindowSize(te.clientInitialWindowSize))
opts = append(opts, grpc.WithStaticStreamWindowSize(te.clientInitialWindowSize))
}
if te.clientInitialConnWindowSize > 0 {
opts = append(opts, grpc.WithInitialConnWindowSize(te.clientInitialConnWindowSize))
opts = append(opts, grpc.WithStaticConnWindowSize(te.clientInitialConnWindowSize))
}
if te.perRPCCreds != nil {
opts = append(opts, grpc.WithPerRPCCredentials(te.perRPCCreds))
Expand Down Expand Up @@ -5505,6 +5505,7 @@ func testConfigurableWindowSize(t *testing.T, e env, wc windowSizeConfig) {
Payload: payload,
}
for i := 0; i < numOfIter; i++ {
t.Logf("easwars: iteration %d", i)
if err := stream.Send(req); err != nil {
t.Fatalf("%v.Send(%v) = %v, want <nil>", stream, req, err)
}
Expand Down
Loading
Loading