summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-11-20 09:30:27 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-11-20 09:30:27 (GMT)
commit22e22bfd0965e01fea041e053873d352387805f6 (patch)
tree7addd4ba068372c9335fdfa768803a50db894ea0
parent09eedacec4b9f349e22a77ecba29c7ece9cc58e1 (diff)
downloaduscxml-22e22bfd0965e01fea041e053873d352387805f6.zip
uscxml-22e22bfd0965e01fea041e053873d352387805f6.tar.gz
uscxml-22e22bfd0965e01fea041e053873d352387805f6.tar.bz2
Only start HTTP server if there is something to serve
-rw-r--r--src/uscxml/server/HTTPServer.cpp9
-rw-r--r--test/src/test-communication.cpp.old31
-rw-r--r--test/src/test-completion.cpp.old20
3 files changed, 8 insertions, 52 deletions
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 <DOM/io/Stream.hpp>
-
-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<Interpreter*> _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<Interpreter*>::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 <DOM/io/Stream.hpp>
-
-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