Commit 13317868 authored by Volodymyr Yurchenko's avatar Volodymyr Yurchenko
Browse files

Check env vars to get ping timeout settings

parent 22baeb12
......@@ -50,6 +50,9 @@ private:
static int writeable_flag;
static int receive_flag;
const int default_ping_timeout = 20;
const int default_ping_interval = 20;
struct lws_context *context; // Context contains all information about connection
/* struct lws_context_creation_info creation_info; // Info to create logical connection */
struct lws *wsi; // WebSocket Instance - real connection object, created basing on context
......
......@@ -109,7 +109,7 @@ void TJAlienConnectionManager::ConnectJBox(TJAlienCredentialsObject c)
{
// Try to load host and port env vars
std::string jboxHost = std::getenv("JALIEN_HOST") ? : "";
int jboxPort = std::getenv("JALIEN_WSPORT") ? atoi(std::getenv("JALIEN_WSPORT")) : 0;
int jboxPort = std::getenv("JALIEN_WSPORT") ? stoi(std::getenv("JALIEN_WSPORT")) : 0;
if (jboxHost.length() == 0 || jboxPort == 0) {
// Try to find jclient_token file
......@@ -189,8 +189,8 @@ void TJAlienConnectionManager::MakeWebsocketConnection(TJAlienCredentialsObject
creation_info.vhost_name = "tjalien-root";
creation_info.options |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
if(is_ipv4) creation_info.options |= LWS_SERVER_OPTION_DISABLE_IPV6;
creation_info.ws_ping_pong_interval = 20;
creation_info.timeout_secs = 20;
creation_info.ws_ping_pong_interval = std::getenv("JALIEN_PING_INTERVAL") ? std::stoi(std::getenv("JALIEN_PING_INTERVAL")) : default_ping_interval;
creation_info.timeout_secs = std::getenv("JALIEN_PING_TIMEOUT") ? std::stoi(std::getenv("JALIEN_PING_TIMEOUT")) : default_ping_timeout;
// TODO (nhardi): switch to explicit key/cert contents
// see the context_creation_info
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment