File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
main/java/io/grpc/internal
test/java/io/grpc/internal Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -449,11 +449,7 @@ private void shutdownRemaining(SubchannelData activeSubchannelData) {
449449 */
450450 @ Override
451451 public void requestConnection () {
452- // Immediately transition to CONNECTING if we are currently IDLE.
453- if (rawConnectivityState == IDLE ) {
454- rawConnectivityState = CONNECTING ;
455- updateBalancingState (CONNECTING , new Picker (PickResult .withNoResult ()));
456- }
452+ boolean wasIdle = rawConnectivityState == IDLE ;
457453 if (!addressIndex .isValid () || rawConnectivityState == SHUTDOWN ) {
458454 return ;
459455 }
@@ -469,6 +465,10 @@ public void requestConnection() {
469465 case IDLE :
470466 subchannelData .subchannel .requestConnection ();
471467 subchannelData .updateState (CONNECTING );
468+ if (wasIdle ) {
469+ rawConnectivityState = CONNECTING ;
470+ updateBalancingState (CONNECTING , new Picker (PickResult .withNoResult ()));
471+ }
472472 scheduleNextConnection ();
473473 break ;
474474 case CONNECTING :
Original file line number Diff line number Diff line change @@ -2461,7 +2461,7 @@ public void happy_eyeballs_pick_pushes_index_over_end() {
24612461 PickResult pickResult = requestingPicker .pickSubchannel (mockArgs );
24622462 assertEquals ("RequestConnectionPicker" , requestingPicker .getClass ().getSimpleName ());
24632463 assertEquals (PickResult .withNoResult (), pickResult );
2464- assertEquals (IDLE , loadBalancer .getConcludedConnectivityState ());
2464+ assertEquals (CONNECTING , loadBalancer .getConcludedConnectivityState ());
24652465
24662466 // Second pick moves index to addr 3
24672467 pickResult = requestingPicker .pickSubchannel (mockArgs );
@@ -2496,7 +2496,7 @@ public void happy_eyeballs_pick_pushes_index_over_end() {
24962496 pickResult = requestingPicker2 .pickSubchannel (mockArgs );
24972497 assertEquals (PickResult .withNoResult (), pickResult );
24982498 }
2499- assertEquals (IDLE , loadBalancer .getConcludedConnectivityState ());
2499+ assertEquals (CONNECTING , loadBalancer .getConcludedConnectivityState ());
25002500
25012501 listeners [0 ].onSubchannelState (ConnectivityStateInfo .forTransientFailure (error ));
25022502 inOrder .verify (mockSubchannel2n2 ).start (stateListenerCaptor .capture ());
You can’t perform that action at this time.
0 commit comments