diff options
Diffstat (limited to 'src/apps/uscxml-browser.cpp')
-rw-r--r-- | src/apps/uscxml-browser.cpp | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/src/apps/uscxml-browser.cpp b/src/apps/uscxml-browser.cpp index dd0633b..bda1efe 100644 --- a/src/apps/uscxml-browser.cpp +++ b/src/apps/uscxml-browser.cpp @@ -25,32 +25,32 @@ int main(int argc, char** argv) { InterpreterOptions::printUsageAndExit(argv[0]); } - if (!options.validate) { - // setup HTTP server - HTTPServer::SSLConfig* sslConf = NULL; - if (options.certificate.length() > 0) { - sslConf = new HTTPServer::SSLConfig(); - sslConf->privateKey = options.certificate; - sslConf->publicKey = options.certificate; - sslConf->port = options.httpsPort; - - } else if (options.privateKey.length() > 0 && options.publicKey.length() > 0) { - sslConf = new HTTPServer::SSLConfig(); - sslConf->privateKey = options.privateKey; - sslConf->publicKey = options.publicKey; - sslConf->port = options.httpsPort; - - } - HTTPServer::getInstance(options.httpPort, options.wsPort, sslConf); - } - - if (options.pluginPath.length() > 0) { - Factory::setDefaultPluginPath(options.pluginPath); - } - - if (options.verbose) { - Factory::getInstance()->listComponents(); - } + if (!options.validate) { + // setup HTTP server + HTTPServer::SSLConfig* sslConf = NULL; + if (options.certificate.length() > 0) { + sslConf = new HTTPServer::SSLConfig(); + sslConf->privateKey = options.certificate; + sslConf->publicKey = options.certificate; + sslConf->port = options.httpsPort; + + } else if (options.privateKey.length() > 0 && options.publicKey.length() > 0) { + sslConf = new HTTPServer::SSLConfig(); + sslConf->privateKey = options.privateKey; + sslConf->publicKey = options.publicKey; + sslConf->port = options.httpsPort; + + } + HTTPServer::getInstance(options.httpPort, options.wsPort, sslConf); + } + + if (options.pluginPath.length() > 0) { + Factory::setDefaultPluginPath(options.pluginPath); + } + + if (options.verbose) { + Factory::getInstance()->listComponents(); + } // instantiate and configure interpreters std::list<Interpreter> interpreters; @@ -73,7 +73,7 @@ int main(int argc, char** argv) { if (issues.size() == 0) { LOGD(USCXML_DEBUG) << "No issues found" << std::endl; } - + } if (options.verbose) { @@ -92,41 +92,41 @@ int main(int argc, char** argv) { } } - if (options.validate) { - return EXIT_SUCCESS; - } - - if (options.withDebugger) { - DebuggerServlet* debugger; - debugger = new DebuggerServlet(); - debugger->copyToInvokers(true); - HTTPServer::getInstance()->registerServlet("/debug", debugger); - for (auto interpreter : interpreters) { - interpreter.addMonitor(debugger); - } - } - + if (options.validate) { + return EXIT_SUCCESS; + } + + if (options.withDebugger) { + DebuggerServlet* debugger; + debugger = new DebuggerServlet(); + debugger->copyToInvokers(true); + HTTPServer::getInstance()->registerServlet("/debug", debugger); + for (auto interpreter : interpreters) { + interpreter.addMonitor(debugger); + } + } + // run interpreters - if (interpreters.size() > 0) { - try { - std::list<Interpreter>::iterator interpreterIter = interpreters.begin(); - while (interpreters.size() > 0) { - while(interpreterIter != interpreters.end()) { - InterpreterState state = interpreterIter->step(); - if (state == USCXML_FINISHED) { - interpreterIter = interpreters.erase(interpreterIter); - } else { - interpreterIter++; - } - } - interpreterIter = interpreters.begin(); - } - } catch (Event e) { - LOGD(USCXML_ERROR) << e << std::endl; - } - } else if (options.withDebugger) { - while(true) - std::this_thread::sleep_for(std::chrono::seconds(1)); - } + if (interpreters.size() > 0) { + try { + std::list<Interpreter>::iterator interpreterIter = interpreters.begin(); + while (interpreters.size() > 0) { + while(interpreterIter != interpreters.end()) { + InterpreterState state = interpreterIter->step(); + if (state == USCXML_FINISHED) { + interpreterIter = interpreters.erase(interpreterIter); + } else { + interpreterIter++; + } + } + interpreterIter = interpreters.begin(); + } + } catch (Event e) { + LOGD(USCXML_ERROR) << e << std::endl; + } + } else if (options.withDebugger) { + while(true) + std::this_thread::sleep_for(std::chrono::seconds(1)); + } return EXIT_SUCCESS; } |