mirror of
https://github.com/nasa/trick.git
synced 2025-01-18 10:46:26 +00:00
Tweaks to comments in embedded web server code.
This commit is contained in:
parent
d0cbd1f2b5
commit
ed64e40803
@ -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
|
Messages sent from Client to Server
|
||||||
================================
|
================================
|
||||||
|
@ -24,16 +24,16 @@ class HTTP_Server {
|
|||||||
pthread_t server_thread; /* ** */
|
pthread_t server_thread; /* ** */
|
||||||
bool shutting_down;
|
bool shutting_down;
|
||||||
|
|
||||||
std::map< std::string, httpMethodHandler> httpGETHandlerMap; /* ** */
|
std::map< std::string, httpMethodHandler> httpGETHandlerMap; /* ** */
|
||||||
pthread_mutex_t httpGETHandlerMapLock; /* ** */
|
pthread_mutex_t httpGETHandlerMapLock; /* ** */
|
||||||
std::map< std::string, WebSocketSessionMaker> WebSocketSessionMakerMap; /* ** */
|
std::map< std::string, WebSocketSessionMaker> WebSocketSessionMakerMap; /* ** */
|
||||||
pthread_mutex_t WebSocketSessionMakerMapLock; /* ** */
|
pthread_mutex_t WebSocketSessionMakerMapLock; /* ** */
|
||||||
std::map<mg_connection*, WebSocketSession*> sessionMap; /* ** */
|
std::map<mg_connection*, WebSocketSession*> sessionMap; /* ** */
|
||||||
pthread_mutex_t sessionMapLock; /* ** */
|
pthread_mutex_t sessionMapLock; /* ** */
|
||||||
pthread_mutex_t serviceLock; /* ** */
|
pthread_mutex_t serviceLock; /* ** */
|
||||||
struct mg_serve_http_opts http_server_options; /* ** mongoose*/
|
struct mg_serve_http_opts http_server_options; /* ** mongoose*/
|
||||||
struct mg_bind_opts bind_opts; /* ** mongoose*/
|
struct mg_bind_opts bind_opts; /* ** mongoose*/
|
||||||
pthread_cond_t serviceConnections; /* ** */
|
pthread_cond_t serviceConnections; /* ** */
|
||||||
|
|
||||||
// Trick Job-functions
|
// Trick Job-functions
|
||||||
int http_default_data();
|
int http_default_data();
|
||||||
@ -41,10 +41,10 @@ class HTTP_Server {
|
|||||||
int http_top_of_frame();
|
int http_top_of_frame();
|
||||||
int http_shutdown();
|
int http_shutdown();
|
||||||
|
|
||||||
void installWebSocketSessionMaker(std::string name, WebSocketSessionMaker creater);
|
void installWebSocketSessionMaker(std::string name, WebSocketSessionMaker maker);
|
||||||
void installHTTPGEThandler(std::string APIname, httpMethodHandler handler);
|
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.
|
// because they need to be callable from the servers event handler.
|
||||||
void sendWebSocketSessionMessages(struct mg_connection *nc);
|
void sendWebSocketSessionMessages(struct mg_connection *nc);
|
||||||
void handleWebSocketClientMessage(struct mg_connection *nc, std::string msg);
|
void handleWebSocketClientMessage(struct mg_connection *nc, std::string msg);
|
||||||
|
@ -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) {
|
void HTTP_Server::installHTTPGEThandler(std::string handlerName, httpMethodHandler handler) {
|
||||||
pthread_mutex_lock(&httpGETHandlerMapLock);
|
pthread_mutex_lock(&httpGETHandlerMapLock);
|
||||||
httpGETHandlerMap.insert(std::pair<std::string, httpMethodHandler>(handlerName, handler));
|
httpGETHandlerMap.insert(std::pair<std::string, httpMethodHandler>(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) {
|
void HTTP_Server::addWebSocketSession(struct mg_connection *nc, WebSocketSession* session) {
|
||||||
pthread_mutex_lock(&sessionMapLock);
|
pthread_mutex_lock(&sessionMapLock);
|
||||||
sessionMap.insert( std::pair<mg_connection*, WebSocketSession*>(nc, session) );
|
sessionMap.insert( std::pair<mg_connection*, WebSocketSession*>(nc, session) );
|
||||||
|
Loading…
Reference in New Issue
Block a user