fix issue with SysView in WebSocket mode dieing and not starting network services;

pull/121/merge
Bryan Biedenkapp 1 month ago
parent 86db348956
commit e550b46c4b

@ -22,6 +22,9 @@
# file.
#
# Flag indicating whether the host will run as a background or foreground task.
daemon: false
#
# Logging Configuration (only used in WebSocket mode)
#

@ -226,6 +226,12 @@ int HostWS::run()
if (!ret)
return EXIT_FAILURE;
// In daemon websocket mode, run the network pump in the post-fork child.
if (m_daemon) {
if (!startNetworkPumpThread())
return EXIT_FAILURE;
}
yaml::Node fne = g_conf["fne"];
std::string fneRESTAddress = fne["restAddress"].as<std::string>("127.0.0.1");
uint16_t fneRESTPort = (uint16_t)fne["restPort"].as<uint32_t>(9990U);

@ -1053,6 +1053,13 @@ void* threadNetworkPump(void* arg)
return nullptr;
}
/* Starts the network pump worker thread. */
bool startNetworkPumpThread()
{
return Thread::runAsThread(nullptr, threadNetworkPump);
}
/* Helper to pring usage the command line arguments. (And optionally an error.) */
void usage(const char* message, const char* arg)
@ -1209,9 +1216,19 @@ int main(int argc, char** argv)
::fatal("cannot read the configuration file - %s (%s)", g_iniFile.c_str(), e.message());
}
/** Network Thread */
if (!Thread::runAsThread(nullptr, threadNetworkPump))
return EXIT_FAILURE;
bool wsDaemonMode = false;
#if !defined(NO_WEBSOCKETS)
if (g_webSocketMode) {
bool daemon = g_conf["daemon"].as<bool>(false);
wsDaemonMode = daemon && !g_foreground;
}
#endif // !defined(NO_WEBSOCKETS)
// In websocket daemon mode HostWS forks, so the child must start the network pump.
if (!wsDaemonMode) {
if (!startNetworkPumpThread())
return EXIT_FAILURE;
}
finalcut::FApplication::setColorTheme<dvmColorTheme>();

@ -109,6 +109,12 @@ extern HOST_SW_API std::string resolveTGID(uint32_t id);
*/
extern HOST_SW_API bool createPeerNetwork();
/**
* @brief Starts the network pump worker thread.
* @returns bool True, if the thread was started successfully, otherwise false.
*/
extern HOST_SW_API bool startNetworkPumpThread();
/**
* @brief
* @returns PeerNetwork*

Loading…
Cancel
Save

Powered by TurnKey Linux.