From 22e22bfd0965e01fea041e053873d352387805f6 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Wed, 20 Nov 2013 10:30:27 +0100 Subject: Only start HTTP server if there is something to serve --- src/uscxml/server/HTTPServer.cpp | 9 ++++++++- test/src/test-communication.cpp.old | 31 ------------------------------- test/src/test-completion.cpp.old | 20 -------------------- 3 files changed, 8 insertions(+), 52 deletions(-) delete mode 100644 test/src/test-communication.cpp.old delete mode 100644 test/src/test-completion.cpp.old diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index 2258ab0..358c819 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -173,7 +173,14 @@ HTTPServer* HTTPServer::getInstance(unsigned short port, unsigned short wsPort, evthread_use_windows_threads(); #endif _instance = new HTTPServer(port, wsPort, sslConf); - _instance->start(); + + // only start if we have something to do! +#if (defined EVENT_SSL_FOUND && defined OPENSSL_FOUND && defined OPENSSL_HAS_ELIPTIC_CURVES) + if (_instance->_httpHandle || _instance->_wsHandle || _instance->_sslHandle) +#else + if (_instance->_httpHandle || _instance->_wsHandle) +#endif + _instance->start(); } return _instance; } diff --git a/test/src/test-communication.cpp.old b/test/src/test-communication.cpp.old deleted file mode 100644 index a0cdbbd..0000000 --- a/test/src/test-communication.cpp.old +++ /dev/null @@ -1,31 +0,0 @@ -#include "uscxml/Interpreter.h" -#include - -int main(int argc, char** argv) { - if (argc != 2) { - std::cerr << "Expected path to test-communication.scxml" << std::endl; - exit(EXIT_FAILURE); - } - - - using namespace uscxml; - std::list _interpreters; - -// Event e; -// e.compound["foo"] = Data("bar", Data::VERBATIM); -// e.compound["foo2"] = Data("bar2", Data::VERBATIM); -// std::cout << e.toDocument() << std::endl; - - int nrInterpreters = 1; - for (int i = 0; i < nrInterpreters; i++) { - _interpreters.push_back(Interpreter::fromURI(argv[1])); - _interpreters.back()->start(); - } - - std::list::iterator interIter = _interpreters.begin(); - while(interIter != _interpreters.end()) { - (*interIter)->join(); - interIter++; - } - -} \ No newline at end of file diff --git a/test/src/test-completion.cpp.old b/test/src/test-completion.cpp.old deleted file mode 100644 index 67d8708..0000000 --- a/test/src/test-completion.cpp.old +++ /dev/null @@ -1,20 +0,0 @@ -#include "uscxml/Interpreter.h" -#include "uscxml/debug/SCXMLDotWriter.h" -#include - -int main(int argc, char** argv) { - if (argc != 2) { - std::cerr << "Expected path to scxml document" << std::endl; - exit(EXIT_FAILURE); - } - - using namespace uscxml; - - Interpreter* interpreter = Interpreter::fromURI(argv[1]); - //SCXMLDotWriter::toDot("output.dot", interpreter); - - interpreter->interpret(); - - - return EXIT_SUCCESS; -} \ No newline at end of file -- cgit v0.12