From 6f0e1d66ce1909d5b9883c2bd29638c604c2e2ef Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Thu, 5 Sep 2019 17:18:04 -0700 Subject: [PATCH] Remove CWMP_KEEP_ALIVE_TIMEOUT This turned out not to be necessary. Will use SESSION_TIMEOUT for connection timeout. --- bin/genieacs-cwmp | 4 +--- docs/environment-variables.rst | 10 ---------- lib/config.ts | 1 - lib/server.ts | 4 ++-- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/bin/genieacs-cwmp b/bin/genieacs-cwmp index b974d79..7e75c1c 100755 --- a/bin/genieacs-cwmp +++ b/bin/genieacs-cwmp @@ -81,8 +81,6 @@ if (!cluster.worker) { cert: config.get("CWMP_SSL_CERT") }; - const keepAliveTimeout = config.get("CWMP_KEEP_ALIVE_TIMEOUT") as number; - process.on("uncaughtException", err => { if ((err as NodeJS.ErrnoException).code === "ERR_IPC_DISCONNECTED") return; logger.error({ @@ -118,7 +116,7 @@ if (!cluster.worker) { ssl, cwmp.listener, cwmp.onConnection, - keepAliveTimeout + 0 ); }) .catch(err => { diff --git a/docs/environment-variables.rst b/docs/environment-variables.rst index 6b6673d..f17ad85 100644 --- a/docs/environment-variables.rst +++ b/docs/environment-variables.rst @@ -88,16 +88,6 @@ CWMP_ACCESS_LOG_FILE Default: unest -CWMP_KEEP_ALIVE_TIMEOUT - How long (in milliseconds) to maintain an open TCP connection while waiting - for the CPE to send the next HTTP request. If a CPE takes longer to respond - the server will terminate the TCP connection and store the session details - temporarily in the DB cache. This results in a performance hit. Adjust this - for better performance if your devices often take longer than 5 seconds to - respond. - - Default: ``5000`` (Node's default) - NBI_WORKER_PROCESSES The number of worker processes to spawn for genieacs-nbi. A value of 0 means as many as there are CPU cores available. diff --git a/lib/config.ts b/lib/config.ts index 6056e0c..31d0248 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -48,7 +48,6 @@ const options = { CWMP_SSL_KEY: { type: "string", default: "" }, CWMP_LOG_FILE: { type: "path", default: "" }, CWMP_ACCESS_LOG_FILE: { type: "path", default: "" }, - CWMP_KEEP_ALIVE_TIMEOUT: { type: "int", default: 0 }, NBI_WORKER_PROCESSES: { type: "int", default: 0 }, NBI_PORT: { type: "int", default: 7557 }, diff --git a/lib/server.ts b/lib/server.ts index 71ee963..c2bda37 100644 --- a/lib/server.ts +++ b/lib/server.ts @@ -56,7 +56,7 @@ export function start( ssl, _listener, onConnection?, - keepAliveTimeout: number = 0 + keepAliveTimeout: number = -1 ): void { listener = _listener; @@ -77,7 +77,7 @@ export function start( if (onConnection != null) server.on("connection", onConnection); } - if (keepAliveTimeout) server.keepAliveTimeout = keepAliveTimeout; + if (keepAliveTimeout >= 0) server.keepAliveTimeout = keepAliveTimeout; server.listen(port, networkInterface); }