Skip to content
Merged
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
35 changes: 0 additions & 35 deletions clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,22 +255,6 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
cc.dopts.bs = backoff.DefaultExponential
}

if cc.dopts.scChan != nil {
// Blocking wait for the initial service config.
select {
case sc, ok := <-cc.dopts.scChan:
if ok {
cc.sc = &sc
cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{&sc})
}
case <-ctx.Done():
return nil, ctx.Err()
}
}
if cc.dopts.scChan != nil {
go cc.scWatcher()
}

// This creates the name resolver, load balancer, blocking picker etc.
if err := cc.exitIdleMode(); err != nil {
return nil, err
Expand Down Expand Up @@ -746,25 +730,6 @@ func (cc *ClientConn) Connect() {
cc.balancerWrapper.exitIdleMode()
}

func (cc *ClientConn) scWatcher() {
for {
select {
case sc, ok := <-cc.dopts.scChan:
if !ok {
return
}
cc.mu.Lock()
// TODO: load balance policy runtime change is ignored.
// We may revisit this decision in the future.
cc.sc = &sc
cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{&sc})
cc.mu.Unlock()
case <-cc.ctx.Done():
return
}
}
}

// waitForResolvedAddrs blocks until the resolver has provided addresses or the
// context expires. Returns nil unless the context expires first; otherwise
// returns a status error based on the context.
Expand Down
14 changes: 0 additions & 14 deletions dialoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ type dialOptions struct {
block bool
returnLastError bool
timeout time.Duration
scChan <-chan ServiceConfig
authority string
binaryLogger binarylog.Logger
copts transport.ConnectOptions
Expand Down Expand Up @@ -251,19 +250,6 @@ func WithDecompressor(dc Decompressor) DialOption {
})
}

// WithServiceConfig returns a DialOption which has a channel to read the
// service configuration.
//
// Deprecated: service config should be received through name resolver or via
// WithDefaultServiceConfig, as specified at
// https://github.com/grpc/grpc/blob/master/doc/service_config.md. Will be
// removed in a future 1.x release.
func WithServiceConfig(c <-chan ServiceConfig) DialOption {
return newFuncDialOption(func(o *dialOptions) {
o.scChan = c
})
}

// WithConnectParams configures the ClientConn to use the provided ConnectParams
// for creating and maintaining connections to servers.
//
Expand Down
15 changes: 0 additions & 15 deletions test/end2end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ type test struct {
clientNopCompression bool
unaryClientInt grpc.UnaryClientInterceptor
streamClientInt grpc.StreamClientInterceptor
sc <-chan grpc.ServiceConfig
clientInitialWindowSize int32
clientInitialConnWindowSize int32
perRPCCreds credentials.PerRPCCredentials
Expand Down Expand Up @@ -760,10 +759,6 @@ func (d *nopDecompressor) Type() string {
func (te *test) configDial(opts ...grpc.DialOption) ([]grpc.DialOption, string) {
opts = append(opts, grpc.WithDialer(te.e.dialer), grpc.WithUserAgent(te.userAgent))

if te.sc != nil {
opts = append(opts, grpc.WithServiceConfig(te.sc))
}

if te.clientCompression {
opts = append(opts,
grpc.WithCompressor(grpc.NewGZIPCompressor()),
Expand Down Expand Up @@ -1103,20 +1098,10 @@ func testServiceConfigSetup(t *testing.T, e env) *test {
return te
}

func newBool(b bool) (a *bool) {
return &b
}

func newInt(b int) (a *int) {
return &b
}

func newDuration(b time.Duration) (a *time.Duration) {
a = new(time.Duration)
*a = b
return
}

func (s) TestGetMethodConfig(t *testing.T) {
te := testServiceConfigSetup(t, tcpClearRREnv)
defer te.tearDown()
Expand Down
Loading