mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 08:40:55 +00:00
Wait for initial remote probe before connecting to server. Closes #3445
This commit is contained in:
@@ -240,6 +240,9 @@ MainWindow::MainWindow(ICaptureContext &ctx) : QMainWindow(NULL), ui(new Ui::Mai
|
||||
// do a remoteProbe immediately to populate the device list on startup.
|
||||
remoteProbe();
|
||||
|
||||
// allow any early-init replay host switches now that we've populated the device list
|
||||
m_RemoteInitialProbeReady.release();
|
||||
|
||||
// do several small sleeps so we can respond quicker when we need to shut down
|
||||
for(int i = 0; i < 50; i++)
|
||||
{
|
||||
@@ -1932,6 +1935,11 @@ void MainWindow::setRemoteHost(int hostIdx)
|
||||
if(!PromptCloseCapture())
|
||||
return;
|
||||
|
||||
// we only want to block once before the initial remoteProbe has happened. After that once we can
|
||||
// acquire once, we re-release so the next one can happen
|
||||
m_RemoteInitialProbeReady.acquire();
|
||||
m_RemoteInitialProbeReady.release();
|
||||
|
||||
rdcarray<RemoteHost> hosts = m_Ctx.Config().GetRemoteHosts();
|
||||
|
||||
RemoteHost host;
|
||||
|
||||
@@ -250,6 +250,7 @@ private:
|
||||
|
||||
QTimer m_MessageTick;
|
||||
QSemaphore m_RemoteProbeSemaphore;
|
||||
QSemaphore m_RemoteInitialProbeReady;
|
||||
LambdaThread *m_RemoteProbe;
|
||||
|
||||
// m_ProbeRemoteHosts is covered by a lock. On the UI thread we copy it from the config regularly,
|
||||
|
||||
@@ -1099,7 +1099,9 @@ struct AndroidController : public IDeviceProtocolHandler
|
||||
|
||||
{
|
||||
SCOPED_LOCK(lock);
|
||||
ret = devices[GetDeviceID(URL)].name;
|
||||
auto it = devices.find(GetDeviceID(URL));
|
||||
if(it != devices.end())
|
||||
ret = it->second.name;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1125,7 +1127,16 @@ struct AndroidController : public IDeviceProtocolHandler
|
||||
Invoke([this, &result, URL]() {
|
||||
rdcstr deviceID = GetDeviceID(URL);
|
||||
|
||||
Device &dev = devices[deviceID];
|
||||
auto it = devices.find(deviceID);
|
||||
if(it == devices.end())
|
||||
{
|
||||
SET_ERROR_RESULT(result, ResultCode::InternalError,
|
||||
"Android device %s is not a valid device ID, can't launch server",
|
||||
Android::GetFriendlyName(deviceID).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Device &dev = it->second;
|
||||
|
||||
if(!dev.active)
|
||||
{
|
||||
@@ -1254,7 +1265,9 @@ struct AndroidController : public IDeviceProtocolHandler
|
||||
|
||||
{
|
||||
SCOPED_LOCK(lock);
|
||||
portbase = devices[deviceID].portbase;
|
||||
auto it = devices.find(deviceID);
|
||||
if(it != devices.end())
|
||||
portbase = it->second.portbase;
|
||||
}
|
||||
|
||||
if(portbase == 0)
|
||||
@@ -1275,7 +1288,13 @@ struct AndroidController : public IDeviceProtocolHandler
|
||||
|
||||
{
|
||||
SCOPED_LOCK(lock);
|
||||
portbase = devices[deviceID].portbase;
|
||||
auto it = devices.find(deviceID);
|
||||
if(it == devices.end())
|
||||
{
|
||||
SAFE_DELETE(sock);
|
||||
return NULL;
|
||||
}
|
||||
portbase = it->second.portbase;
|
||||
}
|
||||
|
||||
return new AndroidRemoteServer(sock, deviceID, portbase);
|
||||
|
||||
@@ -1257,6 +1257,9 @@ RENDERDOC_CreateRemoteServerConnection(const rdcstr &URL, IRemoteServer **rend)
|
||||
else
|
||||
*rend = new RemoteServer(sock, deviceID);
|
||||
|
||||
if(*rend == NULL)
|
||||
return RDResult(ResultCode::NetworkIOFailed);
|
||||
|
||||
return RDResult(ResultCode::Succeeded);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user