diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 70baf7a5..e377bfbc 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All changes to this project will be documented in this file. +## [8.0.6] - 2020-01-31 + +(snake) add an option to disable answering pongs as response to pings, to test cobra client behavior with hanged connections + ## [8.0.5] - 2020-01-31 (IXCobraConnection) set a ping timeout of 90 seconds. If no pong messages are received as responses to ping for a while, give up and close the connection diff --git a/ixsnake/ixsnake/IXAppConfig.h b/ixsnake/ixsnake/IXAppConfig.h index ca61446c..d1581ef1 100644 --- a/ixsnake/ixsnake/IXAppConfig.h +++ b/ixsnake/ixsnake/IXAppConfig.h @@ -32,6 +32,7 @@ namespace snake // Misc bool verbose; + bool disablePong; }; bool isAppKeyValid(const AppConfig& appConfig, std::string appkey); diff --git a/ixsnake/ixsnake/IXSnakeServer.cpp b/ixsnake/ixsnake/IXSnakeServer.cpp index a9c77549..0394b302 100644 --- a/ixsnake/ixsnake/IXSnakeServer.cpp +++ b/ixsnake/ixsnake/IXSnakeServer.cpp @@ -21,6 +21,15 @@ namespace snake , _server(appConfig.port, appConfig.hostname) { _server.setTLSOptions(appConfig.socketTLSOptions); + + if (appConfig.disablePong) + { + _server.disablePong(); + } + + std::stringstream ss; + ss << "Listening on " << appConfig.hostname << ":" << appConfig.port; + ix::IXCoreLogger::Log(ss.str().c_str()); } // diff --git a/ws/ws.cpp b/ws/ws.cpp index 311ffe99..ae58b2d0 100644 --- a/ws/ws.cpp +++ b/ws/ws.cpp @@ -99,6 +99,7 @@ int main(int argc, char** argv) bool redirect = false; bool version = false; bool verifyNone = false; + bool disablePong = false; int port = 8008; int redisPort = 6379; int statsdPort = 8125; @@ -309,6 +310,7 @@ int main(int argc, char** argv) snakeApp->add_option("--apps_config_path", appsConfigPath, "Path to auth data") ->check(CLI::ExistingPath); snakeApp->add_flag("-v", verbose, "Verbose"); + snakeApp->add_flag("-d", disablePong, "Disable Pongs"); addTLSOptions(snakeApp); CLI::App* httpServerApp = app.add_subcommand("httpd", "HTTP server"); @@ -492,7 +494,8 @@ int main(int argc, char** argv) redisPassword, verbose, appsConfigPath, - tlsOptions); + tlsOptions, + disablePong); } else if (app.got_subcommand("httpd")) { diff --git a/ws/ws.h b/ws/ws.h index 70220322..7fc2501d 100644 --- a/ws/ws.h +++ b/ws/ws.h @@ -142,7 +142,8 @@ namespace ix const std::string& redisPassword, bool verbose, const std::string& appsConfigPath, - const ix::SocketTLSOptions& tlsOptions); + const ix::SocketTLSOptions& tlsOptions, + bool disablePong); int ws_httpd_main(int port, const std::string& hostname, diff --git a/ws/ws_snake.cpp b/ws/ws_snake.cpp index f00501e1..6b3e31bf 100644 --- a/ws/ws_snake.cpp +++ b/ws/ws_snake.cpp @@ -44,7 +44,8 @@ namespace ix const std::string& redisPassword, bool verbose, const std::string& appsConfigPath, - const SocketTLSOptions& socketTLSOptions) + const SocketTLSOptions& socketTLSOptions, + bool disablePong) { snake::AppConfig appConfig; appConfig.port = port; @@ -53,6 +54,7 @@ namespace ix appConfig.redisPort = redisPort; appConfig.redisPassword = redisPassword; appConfig.socketTLSOptions = socketTLSOptions; + appConfig.disablePong = disablePong; // Parse config file auto str = readAsString(appsConfigPath);