mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Fix racing busy signals when connecting to remote servers
This commit is contained in:
@@ -125,15 +125,13 @@ void RemoteHost::CheckStatus()
|
||||
return;
|
||||
}
|
||||
|
||||
// to avoid doing complex work while holding the remote host lock, we check the status here then
|
||||
// call into the internal function that will propagate that data to the proper storage if needed.
|
||||
IRemoteServer *rend = NULL;
|
||||
ReplayStatus status = RENDERDOC_CreateRemoteServerConnection(m_hostname.c_str(), &rend);
|
||||
UpdateStatus(RENDERDOC_CheckRemoteServerConnection(m_hostname.c_str()));
|
||||
}
|
||||
|
||||
if(rend)
|
||||
rend->ShutdownConnection();
|
||||
|
||||
UpdateStatus(status);
|
||||
ReplayStatus RemoteHost::Connect(IRemoteServer **server)
|
||||
{
|
||||
QMutexLocker autolock(&m_data->mutex);
|
||||
return RENDERDOC_CreateRemoteServerConnection(m_hostname.c_str(), server);
|
||||
}
|
||||
|
||||
void RemoteHost::SetConnected(bool connected)
|
||||
|
||||
@@ -93,6 +93,14 @@ public:
|
||||
)");
|
||||
void SetLastCapturePath(const rdcstr &path);
|
||||
|
||||
DOCUMENT(R"(Create a connection to the remote server.
|
||||
|
||||
:return: The status of opening the capture, whether success or failure, and a :class:`RemoteServer`
|
||||
instance if it were successful
|
||||
:rtype: ``pair`` of ReplayStatus and RemoteServer
|
||||
)");
|
||||
ReplayStatus Connect(IRemoteServer **server);
|
||||
|
||||
DOCUMENT(
|
||||
"The :class:`DeviceProtocolController` for this host, or ``None`` if no protocol is in use");
|
||||
IDeviceProtocolController *Protocol() const { return m_protocol; }
|
||||
|
||||
@@ -311,7 +311,7 @@ void ReplayManager::CloseThread()
|
||||
|
||||
ReplayStatus ReplayManager::ConnectToRemoteServer(RemoteHost host)
|
||||
{
|
||||
ReplayStatus status = RENDERDOC_CreateRemoteServerConnection(host.Hostname().c_str(), &m_Remote);
|
||||
ReplayStatus status = host.Connect(&m_Remote);
|
||||
|
||||
if(host.Protocol() && host.Protocol()->GetProtocolName() == "adb")
|
||||
{
|
||||
|
||||
@@ -192,6 +192,11 @@ void RemoteHost::CheckStatus()
|
||||
{
|
||||
}
|
||||
|
||||
ReplayStatus RemoteHost::Connect(IRemoteServer **server)
|
||||
{
|
||||
return ReplayStatus::Succeeded;
|
||||
}
|
||||
|
||||
ReplayStatus RemoteHost::Launch()
|
||||
{
|
||||
return ReplayStatus::Succeeded;
|
||||
|
||||
@@ -597,11 +597,22 @@ void RemoteManager::on_connect_clicked()
|
||||
}
|
||||
else
|
||||
{
|
||||
IRemoteServer *server = NULL;
|
||||
ReplayStatus status =
|
||||
RENDERDOC_CreateRemoteServerConnection(host.Hostname().c_str(), &server);
|
||||
if(server)
|
||||
server->ShutdownServerAndConnection();
|
||||
ReplayStatus status = ReplayStatus::Succeeded;
|
||||
LambdaThread *th = new LambdaThread([&host, &status]() {
|
||||
IRemoteServer *server = NULL;
|
||||
status = host.Connect(&server);
|
||||
if(server)
|
||||
server->ShutdownServerAndConnection();
|
||||
});
|
||||
th->start();
|
||||
th->wait(500);
|
||||
if(th->isRunning())
|
||||
{
|
||||
ShowProgressDialog(this, tr("Shutting down server, please wait..."),
|
||||
[th]() { return !th->isRunning(); });
|
||||
}
|
||||
th->deleteLater();
|
||||
|
||||
setRemoteServerLive(node, false, false);
|
||||
|
||||
if(status != ReplayStatus::Succeeded)
|
||||
|
||||
Reference in New Issue
Block a user