func()

in grpcgcp/gcp_picker.go [153:173]


func (p *gcpPicker) getAndIncrementSubConnRef(ctx context.Context, boundKey string, cmd grpc_gcp.AffinityConfig_Command) (*subConnRef, error) {
	if cmd == grpc_gcp.AffinityConfig_BIND && p.gb.cfg.GetChannelPool().GetBindPickStrategy() == grpc_gcp.ChannelPoolConfig_ROUND_ROBIN {
		scRef := p.gb.getSubConnRoundRobin(ctx)
		if p.log.V(FINEST) {
			p.log.Infof("picking SubConn for round-robin bind: %p", scRef.subConn)
		}
		scRef.streamsIncr()
		return scRef, nil
	}

	p.mu.Lock()
	defer p.mu.Unlock()
	scRef, err := p.getSubConnRef(boundKey)
	if err != nil {
		return nil, err
	}
	if scRef != nil {
		scRef.streamsIncr()
	}
	return scRef, nil
}