Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7877f380 authored by Ruoyao Liu (刘若尧)'s avatar Ruoyao Liu (刘若尧) Committed by Denis Hsu
Browse files

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
Change-Id: I03c4161a01861b47cf878945f7f5cc77c821cd57
parent 4ee76530
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -959,7 +959,9 @@ public class DhcpClient extends StateMachine {
                Log.e(TAG, "Fail to start DHCP Packet Handler");
                Log.e(TAG, "Fail to start DHCP Packet Handler");
            }
            }
            notifyFailure();
            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
        @Override