Add failsafe so we don't wait the whole timeout if an apk closes/crashes

This commit is contained in:
baldurk
2018-01-26 18:51:46 +00:00
parent 79f3f54b84
commit 077402bf11
+10
View File
@@ -170,6 +170,16 @@ uint32_t StartAndroidPackageForCapture(const char *host, const char *package)
break;
}
// check to see if the PID is still there. If it was before and isn't now, the APK has exited
// without ever opening a connection.
int curpid = GetCurrentPID(deviceID, packageName);
if(pid != 0 && curpid == 0)
{
RDCERR("APK has crashed or never opened target control connection before closing.");
break;
}
Threading::Sleep(1000);
elapsed += 1000;
}