diff options
author | Xiao Ma <xiaom@google.com> | 2020-04-22 03:21:51 +0000 |
---|---|---|
committer | Xiao Ma <xiaom@google.com> | 2020-04-30 00:57:02 +0000 |
commit | 904eb826d0ce2f4ae8c3a1fa1abcd9adb0897765 (patch) | |
tree | 55c8ecb975b14fcf9bb5fe8e54c761d2c70e402e /src | |
parent | 90b9ebe5f6cf77435373ebab0e14770a8bcc0d4d (diff) |
Fix the potential double transition in DhcpState#enter
The double transition problem might happen when interface is gone by
accident after starting DhcpClient. The StateMachine doesn’t allow
to call transitionTo() in enter().
Use deferMessage() instead to avoid this crash.
Bug: 145182281
Test: manual
Merged-In: I03c4161a01861b47cf878945f7f5cc77c821cd57
Change-Id: I03c4161a01861b47cf878945f7f5cc77c821cd57
Diffstat (limited to 'src')
-rw-r--r-- | src/android/net/dhcp/DhcpClient.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java index c13dc18..6d48c0c 100644 --- a/src/android/net/dhcp/DhcpClient.java +++ b/src/android/net/dhcp/DhcpClient.java @@ -959,7 +959,9 @@ public class DhcpClient extends StateMachine { Log.e(TAG, "Fail to start DHCP Packet Handler"); } notifyFailure(); - transitionTo(mStoppedState); + // We cannot call transitionTo because a transition is still in progress. + // Instead, ensure that we process CMD_STOP_DHCP as soon as the transition is complete. + deferMessage(obtainMessage(CMD_STOP_DHCP)); } @Override |