| 1350 | } |
| 1351 | |
| 1352 | void Server::runSandboxChain() { |
| 1353 | traceScope(); |
| 1354 | |
| 1355 | if (m_crashReporting) { |
| 1356 | Sentry::initialize(); |
| 1357 | } |
| 1358 | |
| 1359 | m_sandboxController = std::make_unique<SandboxSlave>(*this); |
| 1360 | |
| 1361 | if (!m_sandboxController->initialiseFromCommandLine(getOpt("commandLine", String()), Defaults::SANDBOX_CMD_PREFIX, |
| 1362 | 10000, 30000)) { |
| 1363 | logln("failed to initialize sandbox process"); |
| 1364 | getApp()->prepareShutdown(App::EXIT_SANDBOX_INIT_ERROR); |
| 1365 | return; |
| 1366 | } |
| 1367 | |
| 1368 | auto workerMasterSocket = std::make_shared<StreamingSocket>(); |
| 1369 | |
| 1370 | #ifndef JUCE_WINDOWS |
| 1371 | setsockopt(workerMasterSocket->getRawSocketHandle(), SOL_SOCKET, SO_NOSIGPIPE, nullptr, 0); |
| 1372 | #endif |
| 1373 | |
| 1374 | if (!createWorkerListener(workerMasterSocket, getOpt("isLocal", false), m_port)) { |
| 1375 | logln("failed to create worker listener"); |
| 1376 | getApp()->prepareShutdown(App::EXIT_SANDBOX_BIND_ERROR); |
| 1377 | return; |
| 1378 | } |
| 1379 | |
| 1380 | int waitForMasterSteps = 6000; |
| 1381 | while (!m_sandboxConnectedToMaster) { |
| 1382 | sleep(10); |
| 1383 | if (--waitForMasterSteps <= 0) { |
| 1384 | logln("giving up on waiting for master connection"); |
| 1385 | getApp()->prepareShutdown(App::EXIT_SANDBOX_NO_MASTER); |
| 1386 | return; |
| 1387 | } |
| 1388 | } |
| 1389 | |
| 1390 | if (!m_sandboxController->send(SandboxMessage(SandboxMessage::SANDBOX_PORT, {{"port", m_port}}), nullptr, true)) { |
| 1391 | logln("failed to send sendbox port"); |
| 1392 | getApp()->prepareShutdown(); |
| 1393 | return; |
| 1394 | } |
| 1395 | |
| 1396 | loadKnownPluginList(); |
| 1397 | parsePluginLayouts(); |
| 1398 | m_pluginList.sort(KnownPluginList::sortAlphabetically, true); |
| 1399 | |
| 1400 | logln("sandbox (chain isolation) started: PORT=" << m_port << ", NAME=" << m_name); |
| 1401 | |
| 1402 | while (!m_sandboxReady && !threadShouldExit()) { |
| 1403 | // wait for the master to send the config |
| 1404 | sleep(10); |
| 1405 | } |
| 1406 | |
| 1407 | if (!threadShouldExit()) { |
| 1408 | logln("creating worker"); |
| 1409 | auto w = std::make_shared<Worker>(workerMasterSocket, m_sandboxConfig); |
nothing calls this directly
no test coverage detected