diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-12-20 00:56:45 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-12-20 00:56:45 (GMT) |
commit | 0388c7ac478187ff8d264b6e0275a4c4a43796b9 (patch) | |
tree | 7e62439ebf72b6369ee7b1daa370e6251c06b7e0 /src/uscxml/server/HTTPServer.cpp | |
parent | 22e22bfd0965e01fea041e053873d352387805f6 (diff) | |
download | uscxml-0388c7ac478187ff8d264b6e0275a4c4a43796b9.zip uscxml-0388c7ac478187ff8d264b6e0275a4c4a43796b9.tar.gz uscxml-0388c7ac478187ff8d264b6e0275a4c4a43796b9.tar.bz2 |
Performance and bugfix for WebSockets
Diffstat (limited to 'src/uscxml/server/HTTPServer.cpp')
-rw-r--r-- | src/uscxml/server/HTTPServer.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index 358c819..6b24cd8 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -92,17 +92,24 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss evhttp_set_allowed_methods(_http, allowedMethods); // allow all methods - if (_port > 0) + if (_port > 0) { _httpHandle = evhttp_bind_socket_with_handle(_http, INADDR_ANY, _port); - if (_httpHandle) - LOG(INFO) << "HTTP server listening on tcp/" << _port; + if (_httpHandle) { + LOG(INFO) << "HTTP server listening on tcp/" << _port; + } else { + LOG(ERROR) << "HTTP server cannot bind to tcp/" << _wsPort; + } + } _wsPort = wsPort; - if (_wsPort > 0) + if (_wsPort > 0) { _wsHandle = evws_bind_socket(_evws, _wsPort); - if (_wsHandle) - LOG(INFO) << "WebSocket server listening on tcp/" << _wsPort; - + if (_wsHandle) { + LOG(INFO) << "WebSocket server listening on tcp/" << _wsPort; + } else { + LOG(ERROR) << "WebSocket server cannot bind to tcp/" << _wsPort; + } + } #if (defined EVENT_SSL_FOUND && defined OPENSSL_FOUND && defined OPENSSL_HAS_ELIPTIC_CURVES) _sslHandle = NULL; _https = NULL; @@ -136,11 +143,15 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss evhttp_set_bevcb(_https, sslBufferEventCallback, ctx); evhttp_set_gencb(_https, sslGeneralBufferEventCallback, NULL); - if (_sslPort > 0) + if (_sslPort > 0) { _sslHandle = evhttp_bind_socket_with_handle(_https, INADDR_ANY, _sslPort); - if (_sslHandle) - LOG(INFO) << "HTTPS server listening on tcp/" << _wsPort; + if (_sslHandle) { + LOG(INFO) << "HTTPS server listening on tcp/" << _wsPort; + } else { + LOG(ERROR) << "HTTPS server cannot bind to tcp/" << _wsPort; + } + } } #endif |