summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Hector Chavez <lhchavez@google.com>2018-02-21 20:47:34 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-02-21 20:47:34 +0000
commitfd8ac1653de128a34863df01eab67c409032e6cd (patch)
tree74cc47668b4f7c62d7eb86fbe7e5a177a72887b3
parentb8f10ec3063fd18bfc4794456c71f3f6488dae62 (diff)
parent6621bf3f076e4c8d2810882a845e6d9830728de1 (diff)
downloadethernet-fd8ac1653de128a34863df01eab67c409032e6cd.tar.gz
Avoid re-creating an IpClient if the network has already started am: 22d5a7067c am: fae3a541f8
am: 6621bf3f07 Change-Id: I74b63b47f4e79a2fb2aa27c5c4d8edd8c51ea63e
-rw-r--r--java/com/android/server/ethernet/EthernetNetworkFactory.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index 29464b7..d464879 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -280,11 +280,14 @@ public class EthernetNetworkFactory extends NetworkFactory {
}
private void start() {
+ if (mIpClient != null) {
+ if (DBG) Log.d(TAG, "IpClient already started");
+ return;
+ }
if (DBG) {
Log.d(TAG, String.format("starting IpClient(%s): mNetworkInfo=%s", name,
mNetworkInfo));
}
- if (mIpClient != null) stop();
mNetworkInfo.setDetailedState(DetailedState.OBTAINING_IPADDR, null, mHwAddress);
@@ -325,6 +328,7 @@ public class EthernetNetworkFactory extends NetworkFactory {
void onIpLayerStopped(LinkProperties linkProperties) {
// This cannot happen due to provisioning timeout, because our timeout is 0. It can only
// happen if we're provisioned and we lose provisioning.
+ stop();
start();
}
@@ -338,12 +342,11 @@ public class EthernetNetworkFactory extends NetworkFactory {
/** Returns true if state has been modified */
boolean updateLinkState(boolean up) {
if (mLinkUp == up) return false;
-
mLinkUp = up;
+
+ stop();
if (up) {
start();
- } else {
- stop();
}
return true;