Allow multiple remote servers on one hostname, on different ports

* When a port is specified (with the usual :12345 suffix on the hostname) we use
  that for remote replay connections. We disable target control enumeration
  since that requires a port _range_ and captured applications self-assign those
  ports. Those can still be accessed via a normal unsuffixed remote specifier -
  even if there is no remote server running on the default port.
This commit is contained in:
baldurk
2022-02-15 15:59:46 +00:00
parent 435ed5ad38
commit 99adcc614f
6 changed files with 66 additions and 11 deletions
+10 -3
View File
@@ -456,6 +456,7 @@ private:
std::string host;
bool daemon = false;
bool preview = false;
uint16_t port = 0;
public:
RemoteServerCommand() : Command() {}
@@ -465,6 +466,9 @@ public:
parser.add<std::string>(
"host", 'h', "The interface to listen on. By default listens on all interfaces", false, "");
parser.add("preview", 'v', "Display a preview window when a replay is active.");
parser.add<uint32_t>(
"port", 'p',
"The port to listen on. Default is 0, which listens on RenderDoc's default port.", false, 0);
}
virtual const char *Description()
{
@@ -478,12 +482,15 @@ public:
host = parser.get<std::string>("host");
daemon = parser.exist("daemon");
preview = parser.exist("preview");
port = parser.get<uint32_t>("port") & 0xffff;
return true;
}
virtual int Execute(const CaptureOptions &)
{
std::cerr << "Spawning a replay host listening on " << (host.empty() ? "*" : host) << "..."
<< std::endl;
std::cerr << "Spawning a replay host listening on " << (host.empty() ? "*" : host);
if(port != 0)
std::cerr << ":" << port;
std::cerr << "..." << std::endl;
if(daemon)
{
@@ -504,7 +511,7 @@ public:
if(DisplayRemoteServerPreview(false, {}).system != WindowingSystem::Unknown)
previewWindow = &DisplayRemoteServerPreview;
RENDERDOC_BecomeRemoteServer(conv(host), []() { return killSignal; }, previewWindow);
RENDERDOC_BecomeRemoteServer(conv(host), port, []() { return killSignal; }, previewWindow);
std::cerr << std::endl << "Cleaning up from replay hosting." << std::endl;