Merge "Fix leak of DhcpServer on tethering stop error" am: 7e5a5a6983
am: 7afb36786c
Change-Id: Ie73481e8d91ce43e4939f8c31a9ce431e382c6d9
This commit is contained in:
@@ -433,6 +433,9 @@ public class IpServer extends StateMachine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ifcg.clearFlag("running");
|
ifcg.clearFlag("running");
|
||||||
|
|
||||||
|
// TODO: this may throw if the interface is already gone. Do proper handling and
|
||||||
|
// simplify the DHCP server start/stop.
|
||||||
mNMService.setInterfaceConfig(mIfaceName, ifcg);
|
mNMService.setInterfaceConfig(mIfaceName, ifcg);
|
||||||
|
|
||||||
if (!configureDhcp(enabled, (Inet4Address) addr, prefixLen)) {
|
if (!configureDhcp(enabled, (Inet4Address) addr, prefixLen)) {
|
||||||
@@ -440,6 +443,14 @@ public class IpServer extends StateMachine {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mLog.e("Error configuring interface " + e);
|
mLog.e("Error configuring interface " + e);
|
||||||
|
if (!enabled) {
|
||||||
|
try {
|
||||||
|
// Calling stopDhcp several times is fine
|
||||||
|
stopDhcp();
|
||||||
|
} catch (Exception dhcpError) {
|
||||||
|
mLog.e("Error stopping DHCP", dhcpError);
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user