mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 16:50:44 +00:00
Ping the connected host regularly and check other hosts at lower freq.
* This lets us detect when a remote server has been disconnected and needs to be restarted, as well as alerting the user if this happens in the middle of a replay session. * Pinging other hosts means the context switcher is reasonably up to date if one of them comes up.
This commit is contained in:
@@ -480,6 +480,8 @@ struct IRemoteServer
|
||||
|
||||
virtual void ShutdownServerAndConnection() = 0;
|
||||
|
||||
virtual bool Ping() = 0;
|
||||
|
||||
virtual bool LocalProxies(rdctype::array<rdctype::str> *out) = 0;
|
||||
virtual bool RemoteSupportedReplays(rdctype::array<rdctype::str> *out) = 0;
|
||||
|
||||
@@ -517,6 +519,8 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_ShutdownConnection(Remot
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC
|
||||
RemoteServer_ShutdownServerAndConnection(RemoteServer *remote);
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC RemoteServer_Ping(RemoteServer *remote);
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
RemoteServer_LocalProxies(RemoteServer *remote, rdctype::array<rdctype::str> *out);
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
|
||||
@@ -75,6 +75,7 @@ enum RemoteServerPacket
|
||||
eRemoteServer_VersionMismatch,
|
||||
eRemoteServer_Busy,
|
||||
|
||||
eRemoteServer_Ping,
|
||||
eRemoteServer_RemoteDriverList,
|
||||
eRemoteServer_TakeOwnershipCapture,
|
||||
eRemoteServer_CopyCaptureToRemote,
|
||||
@@ -245,6 +246,10 @@ static void ActiveRemoteClientThread(void *data)
|
||||
SAFE_DELETE(recvser);
|
||||
continue;
|
||||
}
|
||||
else if(type == eRemoteServer_Ping)
|
||||
{
|
||||
sendType = eRemoteServer_Ping;
|
||||
}
|
||||
else if(type == eRemoteServer_RemoteDriverList)
|
||||
{
|
||||
map<RDCDriver, string> drivers = RenderDoc::Inst().GetRemoteDrivers();
|
||||
@@ -721,6 +726,23 @@ public:
|
||||
delete this;
|
||||
}
|
||||
bool Connected() { return m_Socket != NULL && m_Socket->Connected(); }
|
||||
bool Ping()
|
||||
{
|
||||
if(!Connected())
|
||||
return false;
|
||||
|
||||
Serialiser sendData("", Serialiser::WRITING, false);
|
||||
Send(eRemoteServer_Ping, sendData);
|
||||
|
||||
RemoteServerPacket type = eRemoteServer_Noop;
|
||||
Serialiser *ser = NULL;
|
||||
Get(type, &ser);
|
||||
|
||||
SAFE_DELETE(ser);
|
||||
|
||||
return type == eRemoteServer_Ping;
|
||||
}
|
||||
|
||||
bool LocalProxies(rdctype::array<rdctype::str> *out)
|
||||
{
|
||||
if(out == NULL)
|
||||
@@ -1078,6 +1100,11 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_ShutdownServerAndConnect
|
||||
remote->ShutdownServerAndConnection();
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC RemoteServer_Ping(RemoteServer *remote)
|
||||
{
|
||||
return remote->Ping();
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
RemoteServer_LocalProxies(RemoteServer *remote, rdctype::array<rdctype::str> *out)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user