If enumerating remote target controls on Android, distrust everything

* On android sometimes if you connect successfully over a forwarded port you
  haven't actually connected! You need to wait a bit, try and use the socket,
  and then you might find that you've been disconnected.
This commit is contained in:
baldurk
2019-01-03 17:06:37 +00:00
parent 7f0ac0f1fe
commit 355b81f232
+14
View File
@@ -379,6 +379,7 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(
else
nextIdent++;
bool isAndroid = false;
uint32_t lastIdent = RenderDoc_LastTargetControlPort;
if(host != NULL && Android::IsHostADB(host))
{
@@ -386,6 +387,8 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(
std::string deviceID;
Android::ExtractDeviceIDAndIndex(host, index, deviceID);
isAndroid = true;
// each subsequent device gets a new range of ports. The deviceID isn't needed since we already
// forwarded the ports to the right devices.
if(nextIdent == RenderDoc_FirstTargetControlPort)
@@ -401,6 +404,17 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(
if(sock)
{
if(isAndroid)
{
Threading::Sleep(100);
(void)sock->IsRecvDataWaiting();
if(!sock->Connected())
{
SAFE_DELETE(sock);
return 0;
}
}
SAFE_DELETE(sock);
return nextIdent;
}