Ensure VcnGatewayConnection#isQuitting never gets unset after being set
This change ensures that the VcnGatewayConnection can never abort a quitting command; specifically, if a non-quitting disconnect request is processed after a quitting disconnect request, the isQuitting value MUST continue to stay set (as true). Failure to OR the values results in orphaned VcnGatewayConnection(s), and the VCN network thrashing. Additionally reduce verbosity of local logs, to ensure it better captures failures and logWtf(s) Bug: 192776413 Test: atest FrameworksVcnTests Original-Change: https://android-review.googlesource.com/1768623 Merged-In: Iec8dae701838794261957609bae4e270eaa9cdc7 Change-Id: Iec8dae701838794261957609bae4e270eaa9cdc7
This commit is contained in:
@@ -578,6 +578,10 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
|
||||
mGatewayConnection.teardownAsynchronously();
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
// Verify that sending a non-quitting disconnect request does not unset the isQuitting flag
|
||||
mGatewayConnection.sendDisconnectRequestedAndAcquireWakelock("TEST", false);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
assertEquals(mGatewayConnection.mDisconnectingState, mGatewayConnection.getCurrentState());
|
||||
assertTrue(mGatewayConnection.isQuitting());
|
||||
}
|
||||
|
||||
@@ -127,6 +127,10 @@ public class VcnGatewayConnectionConnectingStateTest extends VcnGatewayConnectio
|
||||
mGatewayConnection.teardownAsynchronously();
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
// Verify that sending a non-quitting disconnect request does not unset the isQuitting flag
|
||||
mGatewayConnection.sendDisconnectRequestedAndAcquireWakelock("TEST", false);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
assertEquals(mGatewayConnection.mDisconnectingState, mGatewayConnection.getCurrentState());
|
||||
assertTrue(mGatewayConnection.isQuitting());
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class VcnGatewayConnectionDisconnectedStateTest extends VcnGatewayConnect
|
||||
true /* isMobileDataEnabled */,
|
||||
mDeps);
|
||||
|
||||
vgc.setIsQuitting(true);
|
||||
vgc.setQuitting();
|
||||
vgc.transitionTo(vgc.mDisconnectedState);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
@@ -102,6 +102,10 @@ public class VcnGatewayConnectionDisconnectedStateTest extends VcnGatewayConnect
|
||||
mGatewayConnection.teardownAsynchronously();
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
// Verify that sending a non-quitting disconnect request does not unset the isQuitting flag
|
||||
mGatewayConnection.sendDisconnectRequestedAndAcquireWakelock("TEST", false);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
assertNull(mGatewayConnection.getCurrentState());
|
||||
verify(mIpSecSvc).deleteTunnelInterface(eq(TEST_IPSEC_TUNNEL_RESOURCE_ID), any());
|
||||
verifySafeModeTimeoutAlarmAndGetCallback(true /* expectCanceled */);
|
||||
|
||||
@@ -79,6 +79,10 @@ public class VcnGatewayConnectionDisconnectingStateTest extends VcnGatewayConnec
|
||||
mGatewayConnection.teardownAsynchronously();
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
// Verify that sending a non-quitting disconnect request does not unset the isQuitting flag
|
||||
mGatewayConnection.sendDisconnectRequestedAndAcquireWakelock("TEST", false);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
// Should do nothing; already tearing down.
|
||||
assertEquals(mGatewayConnection.mDisconnectingState, mGatewayConnection.getCurrentState());
|
||||
verifyTeardownTimeoutAlarmAndGetCallback(false /* expectCanceled */);
|
||||
|
||||
@@ -90,6 +90,10 @@ public class VcnGatewayConnectionRetryTimeoutStateTest extends VcnGatewayConnect
|
||||
.onSelectedUnderlyingNetworkChanged(null);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
// Verify that sending a non-quitting disconnect request does not unset the isQuitting flag
|
||||
mGatewayConnection.sendDisconnectRequestedAndAcquireWakelock("TEST", false);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
assertEquals(mGatewayConnection.mDisconnectedState, mGatewayConnection.getCurrentState());
|
||||
verifyRetryTimeoutAlarmAndGetCallback(mFirstRetryInterval, true /* expectCanceled */);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user