Skip to content

Commit

Permalink
New env variable `OPENSTUDIO_APPLICATION_USE_LOCAL_MEASURE_MANAGER_PO…
Browse files Browse the repository at this point in the history
…RT=<int>` to connect to a local measure manager
  • Loading branch information
jmarrec committed Dec 23, 2023
1 parent e4bef14 commit d8ff326
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/openstudio_app/OpenStudioApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,22 @@ void OpenStudioApp::startMeasureManagerProcess() {
// will terminate the existing process, blocking call
delete m_measureManagerProcess;

// Debugging: attach to your own measure manager you've launched in a debugger prior to firing the OSApp.
if (qEnvironmentVariableIsSet("OPENSTUDIO_APPLICATION_USE_LOCAL_MEASURE_MANAGER_PORT")) {
LOG(Debug, "OPENSTUDIO_APPLICATION_USE_LOCAL_MEASURE_MANAGER_PORT is set");
bool ok = false;
const int port = qEnvironmentVariableIntValue("OPENSTUDIO_APPLICATION_USE_LOCAL_MEASURE_MANAGER_PORT", &ok);
if (ok) {
LOG(Debug, "OPENSTUDIO_APPLICATION_USE_LOCAL_MEASURE_MANAGER_PORT is " << port);
QString portString = QString::number(port);
QString urlString = "http://127.0.0.1:" + portString;
QUrl url(urlString);
LOG(Debug, "Connection to existing Local Measure Manager: " << toString(urlString));
measureManager().setUrl(url);
return;
}
}

// find available port
QTcpServer tcpServer;
tcpServer.listen(QHostAddress::LocalHost);
Expand Down

0 comments on commit d8ff326

Please sign in to comment.