Avoid inconsistent state when remove fails.
Bug: 5433432
Change-Id: Ia388fda006cbda09b5947fc61cec6353f75a3805
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 6887de3..da960ae 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -1136,12 +1136,14 @@
final StringBuilder command = new StringBuilder();
command.append("bandwidth removeiquota ").append(iface);
+ mActiveQuotaIfaces.remove(iface);
+ mActiveAlertIfaces.remove(iface);
+
try {
// TODO: support quota shared across interfaces
mConnector.doCommand(command.toString());
- mActiveQuotaIfaces.remove(iface);
- mActiveAlertIfaces.remove(iface);
} catch (NativeDaemonConnectorException e) {
+ // TODO: include current iptables state
throw new IllegalStateException("Error communicating to native daemon", e);
}
}