Bug 777884 - Fix code in watcher to reboot if maximum number of failed ping attempts exceeded;r=jmaher

This commit is contained in:
William Lachance 2012-07-27 15:01:43 -04:00
parent 67b502d665
commit bd9b2fd80f

View File

@ -905,10 +905,15 @@ public class WatcherService extends Service
if (nMaxStrikes > 0)
{
String sRet = SendPing(sPingTarget);
if (!sRet.contains("3 received") && ++nStrikes >= nMaxStrikes)
if (!sRet.contains("3 received"))
{
Log.e("Watcher", String.format("Number of failed ping attempts to %s (%s) exceeded maximum (%s), running reboot!", sPingTarget, nStrikes, nMaxStrikes));
RunReboot(null);
Log.i("Watcher", String.format("Failed ping attempt (remaining: %s)!",
nMaxStrikes - nStrikes));
if (++nStrikes >= nMaxStrikes)
{
Log.e("Watcher", String.format("Number of failed ping attempts to %s (%s) exceeded maximum (%s), running reboot!", sPingTarget, nStrikes, nMaxStrikes));
RunReboot(null);
}
}
else
{