diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-04-22 14:02:03 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-04-22 14:02:03 (GMT) |
commit | 1fb6bcf30f954e426f2d3002d14887574fb941dd (patch) | |
tree | 08cff7f2b879c50efe79e3c04d255075522af862 /src/uscxml/server | |
parent | 71c334bf4e35559496feac3f3cf00b72ceb88812 (diff) | |
download | uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.zip uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.tar.gz uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.tar.bz2 |
Major refactoring
- Moved tests
- Changes to promela datamodel
- Implemented Trie
Diffstat (limited to 'src/uscxml/server')
-rw-r--r-- | src/uscxml/server/HTTPServer.cpp | 10 | ||||
-rw-r--r-- | src/uscxml/server/HTTPServer.h | 4 | ||||
-rw-r--r-- | src/uscxml/server/InterpreterServlet.cpp | 36 |
3 files changed, 25 insertions, 25 deletions
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index 69096fc..2d2b5e0 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -105,7 +105,7 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss LOG(ERROR) << "HTTP server cannot bind to tcp/" << _port; } } - + _wsPort = wsPort; if (_wsPort > 0) { _wsHandle = evws_bind_socket(_evws, _wsPort); @@ -443,7 +443,7 @@ void HTTPServer::processByMatchingServlet(const Request& request) { if (servletIter->first.length() == 0) { matches.insert(std::make_pair(servletPath, servletIter->second)); // single servlet at root } else if (iequals(actualPath.substr(0, servletPath.length()), servletPath) && // servlet path is a prefix - iequals(actualPath.substr(servletPath.length(), 1), "/")) { // and next character is a '/' + iequals(actualPath.substr(servletPath.length(), 1), "/")) { // and next character is a '/' matches.insert(std::make_pair(servletPath, servletIter->second)); } servletIter++; @@ -530,7 +530,7 @@ void HTTPServer::replyCallback(evutil_socket_t fd, short what, void *arg) { delete(reply); } - + void HTTPServer::wsSend(struct evws_connection *conn, enum evws_opcode opcode, const char *data, uint64_t length) { HTTPServer* INSTANCE = getInstance(); WSData* sendCB = new WSData(conn, NULL, opcode, data, length); @@ -553,10 +553,10 @@ void HTTPServer::wsSendCallback(evutil_socket_t fd, short what, void *arg) { evws_send_data(wsSend->conn, wsSend->opcode, wsSend->data.data(), wsSend->data.length()); } } - + delete wsSend; } - + bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet) { HTTPServer* INSTANCE = getInstance(); diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h index 2003130..09a31df 100644 --- a/src/uscxml/server/HTTPServer.h +++ b/src/uscxml/server/HTTPServer.h @@ -108,7 +108,7 @@ public: static void unregisterServlet(WebSocketServlet* servlet); private: - + class WSData { public: WSData(struct evws_connection *conn_, const char *uri_, enum evws_opcode opcode_, const char *data_, uint64_t length_) { @@ -147,7 +147,7 @@ private: static void httpRecvReqCallback(struct evhttp_request *req, void *callbackData); static void wsRecvReqCallback(struct evws_connection *conn, struct evws_frame *, void *callbackData); - + void processByMatchingServlet(const Request& request); void processByMatchingServlet(evws_connection* conn, const WSFrame& frame); diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp index b956820..303aad0 100644 --- a/src/uscxml/server/InterpreterServlet.cpp +++ b/src/uscxml/server/InterpreterServlet.cpp @@ -155,23 +155,23 @@ void InterpreterWebSocketServlet::send(const SendRequest& req) { if (false) { } else if (req.data.binary) { HTTPServer::wsSend(_requests[req.target], - EVWS_BINARY_FRAME, - req.data.binary->data, - req.data.binary->size); + EVWS_BINARY_FRAME, + req.data.binary->data, + req.data.binary->size); } else if (req.data.node) { std::stringstream ssXML; ssXML << req.data.node; std::string data = ssXML.str(); HTTPServer::wsSend(_requests[req.target], - EVWS_TEXT_FRAME, - data.c_str(), - data.length()); + EVWS_TEXT_FRAME, + data.c_str(), + data.length()); } else if (req.data) { std::string data = Data::toJSON(req.data); HTTPServer::wsSend(_requests[req.target], - EVWS_TEXT_FRAME, - data.c_str(), - data.length()); + EVWS_TEXT_FRAME, + data.c_str(), + data.length()); } else { LOG(WARNING) << "Not sure what to make off content given to send on websocket!"; } @@ -180,23 +180,23 @@ void InterpreterWebSocketServlet::send(const SendRequest& req) { if (false) { } else if (req.data.binary) { HTTPServer::wsBroadcast(req.target.c_str(), - EVWS_BINARY_FRAME, - req.data.binary->data, - req.data.binary->size); + EVWS_BINARY_FRAME, + req.data.binary->data, + req.data.binary->size); } else if (req.data.node) { std::stringstream ssXML; ssXML << req.data.node; std::string data = ssXML.str(); HTTPServer::wsBroadcast(req.target.c_str(), - EVWS_TEXT_FRAME, - data.c_str(), - data.length()); + EVWS_TEXT_FRAME, + data.c_str(), + data.length()); } else if (req.data) { std::string data = Data::toJSON(req.data); HTTPServer::wsBroadcast(req.target.c_str(), - EVWS_TEXT_FRAME, - data.c_str(), - data.length()); + EVWS_TEXT_FRAME, + data.c_str(), + data.length()); } else { LOG(WARNING) << "Not sure what to make off content given to broadcast on websocket!"; } |