OSDN Git Service

Missing tethering stats isn't an error.
authorJeff Sharkey <jsharkey@android.com>
Wed, 11 Sep 2013 03:53:58 +0000 (20:53 -0700)
committerJeff Sharkey <jsharkey@android.com>
Wed, 11 Sep 2013 03:53:58 +0000 (20:53 -0700)
When a device first boots, there won't be any tethering stats, which
isn't an error.  Continue checking for partial results.

Bug: 5868832
Change-Id: Ic432f5f159320da9886d85c2525fa2cde8c67750

BandwidthController.cpp

index e31a515..664211d 100644 (file)
@@ -1098,7 +1098,6 @@ int BandwidthController::parseForwardChainStats(SocketClient *cli, const TetherS
     TetherStats stats;
     char *buffPtr;
     int64_t packets, bytes;
-    int statsFound = 0;
 
     bool filterPair = filter.intIface[0] && filter.extIface[0];
 
@@ -1174,11 +1173,10 @@ int BandwidthController::parseForwardChainStats(SocketClient *cli, const TetherS
                 stats = filter;
             }
             free(msg);
-            statsFound++;
         }
     }
-    /* We found some stats, and the last one isn't a partial stats. */
-    if (statsFound && (stats.rxBytes == -1 || stats.txBytes == -1)) {
+    /* Successful if the last stats entry wasn't partial. */
+    if ((stats.rxBytes == -1) == (stats.txBytes == -1)) {
         cli->sendMsg(ResponseCode::CommandOkay, "Tethering stats list completed", false);
         return 0;
     }