Increase maximum wait time to find the target control port after launch

* Sometimes a process can take a while to start, this change waits up
  to 1+2+4+8+16+32+64 = 127 ms which is still not that much.
* Also log a message if we still can't find it, so it's clear what the
  problem was.
This commit is contained in:
baldurk
2017-05-17 17:45:58 +01:00
parent 61dc8806bd
commit 6df6d152f0
+9 -2
View File
@@ -28,7 +28,7 @@
extern char **environ;
#define INITIAL_WAIT_TIME 1000
#define MAX_WAIT_TIME 63000
#define MAX_WAIT_TIME 64000
char **GetCurrentEnvironment()
{
@@ -45,7 +45,7 @@ int GetIdentPort(pid_t childPid)
int totalWaitTime = 0;
// try for a little while for the /proc entry to appear
while(totalWaitTime < MAX_WAIT_TIME)
while(totalWaitTime <= MAX_WAIT_TIME)
{
// back-off for each retry
usleep(waitTime);
@@ -84,6 +84,13 @@ int GetIdentPort(pid_t childPid)
FileIO::fclose(f);
}
if(ret == 0)
{
RDCWARN("Couldn't locate renderdoc target control listening port between %u and %u in %s",
(uint32_t)RenderDoc_FirstTargetControlPort, (uint32_t)RenderDoc_LastTargetControlPort,
procfile.c_str());
}
return ret;
}