From ed64e4080394803de8ebfc43509c7075579f321e Mon Sep 17 00:00:00 2001 From: "John M. Penn" Date: Mon, 26 Aug 2019 13:40:11 -0500 Subject: [PATCH] Tweaks to comments in embedded web server code. --- .../include/VariableServerSession.hh | 2 +- .../mongoose_httpd/include/http_server.hh | 22 +++++++++---------- .../models/mongoose_httpd/src/http_server.cpp | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/trick_sims/Cannon/models/mongoose_httpd/include/VariableServerSession.hh b/trick_sims/Cannon/models/mongoose_httpd/include/VariableServerSession.hh index a475acf2..1da366d6 100644 --- a/trick_sims/Cannon/models/mongoose_httpd/include/VariableServerSession.hh +++ b/trick_sims/Cannon/models/mongoose_httpd/include/VariableServerSession.hh @@ -1,5 +1,5 @@ /************************************************************************* -PURPOSE: (Represent Websocket variable server connection.) +PURPOSE: (Represent the state of a variable server websocket connection.) Messages sent from Client to Server ================================ diff --git a/trick_sims/Cannon/models/mongoose_httpd/include/http_server.hh b/trick_sims/Cannon/models/mongoose_httpd/include/http_server.hh index f3f443fa..40ae22a9 100644 --- a/trick_sims/Cannon/models/mongoose_httpd/include/http_server.hh +++ b/trick_sims/Cannon/models/mongoose_httpd/include/http_server.hh @@ -24,16 +24,16 @@ class HTTP_Server { pthread_t server_thread; /* ** */ bool shutting_down; - std::map< std::string, httpMethodHandler> httpGETHandlerMap; /* ** */ - pthread_mutex_t httpGETHandlerMapLock; /* ** */ + std::map< std::string, httpMethodHandler> httpGETHandlerMap; /* ** */ + pthread_mutex_t httpGETHandlerMapLock; /* ** */ std::map< std::string, WebSocketSessionMaker> WebSocketSessionMakerMap; /* ** */ pthread_mutex_t WebSocketSessionMakerMapLock; /* ** */ - std::map sessionMap; /* ** */ - pthread_mutex_t sessionMapLock; /* ** */ - pthread_mutex_t serviceLock; /* ** */ - struct mg_serve_http_opts http_server_options; /* ** mongoose*/ - struct mg_bind_opts bind_opts; /* ** mongoose*/ - pthread_cond_t serviceConnections; /* ** */ + std::map sessionMap; /* ** */ + pthread_mutex_t sessionMapLock; /* ** */ + pthread_mutex_t serviceLock; /* ** */ + struct mg_serve_http_opts http_server_options; /* ** mongoose*/ + struct mg_bind_opts bind_opts; /* ** mongoose*/ + pthread_cond_t serviceConnections; /* ** */ // Trick Job-functions int http_default_data(); @@ -41,10 +41,10 @@ class HTTP_Server { int http_top_of_frame(); int http_shutdown(); - void installWebSocketSessionMaker(std::string name, WebSocketSessionMaker creater); - void installHTTPGEThandler(std::string APIname, httpMethodHandler handler); + void installWebSocketSessionMaker(std::string name, WebSocketSessionMaker maker); + void installHTTPGEThandler(std::string handlerName, httpMethodHandler handler); - // These are internals and should be considered public. They are not private only + // These are internals, and should be considered public. They are not private only // because they need to be callable from the servers event handler. void sendWebSocketSessionMessages(struct mg_connection *nc); void handleWebSocketClientMessage(struct mg_connection *nc, std::string msg); diff --git a/trick_sims/Cannon/models/mongoose_httpd/src/http_server.cpp b/trick_sims/Cannon/models/mongoose_httpd/src/http_server.cpp index 32f35786..94b99f8e 100644 --- a/trick_sims/Cannon/models/mongoose_httpd/src/http_server.cpp +++ b/trick_sims/Cannon/models/mongoose_httpd/src/http_server.cpp @@ -125,7 +125,7 @@ WebSocketSession* HTTP_Server::makeWebSocketSession(struct mg_connection *nc, st } } -// Install an httpMethodHandler with a name (key) by which it can be retrieved. +// Install an httpMethodHandler with a name, the key by which it can be retrieved. void HTTP_Server::installHTTPGEThandler(std::string handlerName, httpMethodHandler handler) { pthread_mutex_lock(&httpGETHandlerMapLock); httpGETHandlerMap.insert(std::pair(handlerName, handler)); @@ -179,7 +179,7 @@ void HTTP_Server::handleWebSocketClientMessage(struct mg_connection *nc, std::st } } -// Install a WebSocketSession with a connection-pointer (key) by which it can be retrieved. +// Install a WebSocketSession with a connection-pointer, the key by which it can be retrieved. void HTTP_Server::addWebSocketSession(struct mg_connection *nc, WebSocketSession* session) { pthread_mutex_lock(&sessionMapLock); sessionMap.insert( std::pair(nc, session) );