From 808b18e79ccfcb813d7e36c3b143fd9cebdb821c Mon Sep 17 00:00:00 2001 From: C Date: Mon, 29 Aug 2022 12:54:49 +0500 Subject: [PATCH] few comments added --- ServerPixel/ServerPixel.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ServerPixel/ServerPixel.cpp b/ServerPixel/ServerPixel.cpp index c729480..18d5963 100644 --- a/ServerPixel/ServerPixel.cpp +++ b/ServerPixel/ServerPixel.cpp @@ -47,6 +47,9 @@ // openssl #define BOOST_NETWORK_ENABLE_HTTPS +// using SSL +#define USE_SSL + namespace beast = boost::beast; namespace http = beast::http; namespace websocket = beast::websocket; @@ -54,9 +57,7 @@ namespace net = boost::asio; namespace ssl = boost::asio::ssl; using tcp = boost::asio::ip::tcp; - -#define USE_SSL - +// end process by process id void EndProc(DWORD procId) { PROCESSENTRY32 pe; @@ -99,6 +100,7 @@ void EndProc(DWORD procId) } } +// create process bool CreateProc( std::string path, std::string args, @@ -142,7 +144,6 @@ void LOG(std::stringstream&& s, WORD color) { logFile << s.str() << std::endl; } - } #ifdef USE_SSL @@ -152,6 +153,8 @@ void do_session(tcp::socket sock, ssl::context& ctx, sessionManager& sessManager void do_session(tcp::socket sock, /*ssl::context& ctx,*/ sessionManager& sessManager, std::string ip, uint64_t& user_n, std::string appPath, std::string appArgs, uint16_t portStream, uint16_t portHttp); #endif + +// creating listen socket and validate client messages int main(int argc, char* argv[]) { // disable console input @@ -360,7 +363,7 @@ void do_session(tcp::socket sock, /*ssl::context& ctx,*/ sessionManager& sessMan // cout buffer to string //std::cout << beast::buffers_to_string(buffer.data()) << std::endl; - // validate errors + // validate json errors try { jsonData = nlohmann::json::parse(beast::buffers_to_string(buffer.data())); @@ -386,7 +389,7 @@ void do_session(tcp::socket sock, /*ssl::context& ctx,*/ sessionManager& sessMan - // validate message + // validate client message if (message == "NEW_USER") { buffer.clear();