Skip to content

Commit 232054a

Browse files
authored
client: remove deprecated WithServiceConfig DialOption (#6800)
1 parent 42fdcc4 commit 232054a

File tree

4 files changed

+0
-527
lines changed

4 files changed

+0
-527
lines changed

clientconn.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -255,22 +255,6 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
255255
cc.dopts.bs = backoff.DefaultExponential
256256
}
257257

258-
if cc.dopts.scChan != nil {
259-
// Blocking wait for the initial service config.
260-
select {
261-
case sc, ok := <-cc.dopts.scChan:
262-
if ok {
263-
cc.sc = &sc
264-
cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{&sc})
265-
}
266-
case <-ctx.Done():
267-
return nil, ctx.Err()
268-
}
269-
}
270-
if cc.dopts.scChan != nil {
271-
go cc.scWatcher()
272-
}
273-
274258
// This creates the name resolver, load balancer, blocking picker etc.
275259
if err := cc.exitIdleMode(); err != nil {
276260
return nil, err
@@ -746,25 +730,6 @@ func (cc *ClientConn) Connect() {
746730
cc.balancerWrapper.exitIdleMode()
747731
}
748732

749-
func (cc *ClientConn) scWatcher() {
750-
for {
751-
select {
752-
case sc, ok := <-cc.dopts.scChan:
753-
if !ok {
754-
return
755-
}
756-
cc.mu.Lock()
757-
// TODO: load balance policy runtime change is ignored.
758-
// We may revisit this decision in the future.
759-
cc.sc = &sc
760-
cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{&sc})
761-
cc.mu.Unlock()
762-
case <-cc.ctx.Done():
763-
return
764-
}
765-
}
766-
}
767-
768733
// waitForResolvedAddrs blocks until the resolver has provided addresses or the
769734
// context expires. Returns nil unless the context expires first; otherwise
770735
// returns a status error based on the context.

dialoptions.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ type dialOptions struct {
6464
block bool
6565
returnLastError bool
6666
timeout time.Duration
67-
scChan <-chan ServiceConfig
6867
authority string
6968
binaryLogger binarylog.Logger
7069
copts transport.ConnectOptions
@@ -251,19 +250,6 @@ func WithDecompressor(dc Decompressor) DialOption {
251250
})
252251
}
253252

254-
// WithServiceConfig returns a DialOption which has a channel to read the
255-
// service configuration.
256-
//
257-
// Deprecated: service config should be received through name resolver or via
258-
// WithDefaultServiceConfig, as specified at
259-
// https://github.com/grpc/grpc/blob/master/doc/service_config.md. Will be
260-
// removed in a future 1.x release.
261-
func WithServiceConfig(c <-chan ServiceConfig) DialOption {
262-
return newFuncDialOption(func(o *dialOptions) {
263-
o.scChan = c
264-
})
265-
}
266-
267253
// WithConnectParams configures the ClientConn to use the provided ConnectParams
268254
// for creating and maintaining connections to servers.
269255
//

test/end2end_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@ type test struct {
505505
clientNopCompression bool
506506
unaryClientInt grpc.UnaryClientInterceptor
507507
streamClientInt grpc.StreamClientInterceptor
508-
sc <-chan grpc.ServiceConfig
509508
clientInitialWindowSize int32
510509
clientInitialConnWindowSize int32
511510
perRPCCreds credentials.PerRPCCredentials
@@ -760,10 +759,6 @@ func (d *nopDecompressor) Type() string {
760759
func (te *test) configDial(opts ...grpc.DialOption) ([]grpc.DialOption, string) {
761760
opts = append(opts, grpc.WithDialer(te.e.dialer), grpc.WithUserAgent(te.userAgent))
762761

763-
if te.sc != nil {
764-
opts = append(opts, grpc.WithServiceConfig(te.sc))
765-
}
766-
767762
if te.clientCompression {
768763
opts = append(opts,
769764
grpc.WithCompressor(grpc.NewGZIPCompressor()),
@@ -1103,20 +1098,10 @@ func testServiceConfigSetup(t *testing.T, e env) *test {
11031098
return te
11041099
}
11051100

1106-
func newBool(b bool) (a *bool) {
1107-
return &b
1108-
}
1109-
11101101
func newInt(b int) (a *int) {
11111102
return &b
11121103
}
11131104

1114-
func newDuration(b time.Duration) (a *time.Duration) {
1115-
a = new(time.Duration)
1116-
*a = b
1117-
return
1118-
}
1119-
11201105
func (s) TestGetMethodConfig(t *testing.T) {
11211106
te := testServiceConfigSetup(t, tcpClearRREnv)
11221107
defer te.tearDown()

0 commit comments

Comments
 (0)