@@ -1672,10 +1672,7 @@ private void handleNetworkDisconnect() {
16721672 /* In case we were in middle of DHCP operation
16731673 restore back powermode */
16741674 handlePostDhcpSetup ();
1675-
16761675 mDhcpStateMachine .sendMessage (DhcpStateMachine .CMD_STOP_DHCP );
1677- mDhcpStateMachine .doQuit ();
1678- mDhcpStateMachine = null ;
16791676 }
16801677
16811678 try {
@@ -1928,6 +1925,9 @@ public boolean processMessage(Message message) {
19281925 case CMD_CLEAR_SUSPEND_OPTIMIZATIONS :
19291926 case CMD_NO_NETWORKS_PERIODIC_SCAN :
19301927 break ;
1928+ case DhcpStateMachine .CMD_ON_QUIT :
1929+ mDhcpStateMachine = null ;
1930+ break ;
19311931 case CMD_SET_SUSPEND_OPTIMIZATIONS :
19321932 mSuspendWakeLock .release ();
19331933 break ;
@@ -2498,6 +2498,9 @@ public void enter() {
24982498
24992499 /* Send any reset commands to supplicant before shutting it down */
25002500 handleNetworkDisconnect ();
2501+ if (mDhcpStateMachine != null ) {
2502+ mDhcpStateMachine .doQuit ();
2503+ }
25012504
25022505 if (DBG ) log ("stopping supplicant" );
25032506 if (!mWifiNative .stopSupplicant ()) {
@@ -3197,8 +3200,11 @@ public void enter() {
31973200
31983201 if (!mWifiConfigStore .isUsingStaticIp (mLastNetworkId )) {
31993202 //start DHCP
3200- mDhcpStateMachine = DhcpStateMachine .makeDhcpStateMachine (
3201- mContext , WifiStateMachine .this , mInterfaceName );
3203+ if (mDhcpStateMachine == null ) {
3204+ mDhcpStateMachine = DhcpStateMachine .makeDhcpStateMachine (
3205+ mContext , WifiStateMachine .this , mInterfaceName );
3206+
3207+ }
32023208 mDhcpStateMachine .registerForPreDhcpNotification ();
32033209 mDhcpStateMachine .sendMessage (DhcpStateMachine .CMD_START_DHCP );
32043210 } else {
0 commit comments