diff --git a/bin/genieacs-cwmp b/bin/genieacs-cwmp index 3ff1db5..b974d79 100755 --- a/bin/genieacs-cwmp +++ b/bin/genieacs-cwmp @@ -81,6 +81,8 @@ 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({ @@ -115,7 +117,8 @@ if (!cluster.worker) { SERVICE_ADDRESS, ssl, cwmp.listener, - cwmp.onConnection + cwmp.onConnection, + keepAliveTimeout ); }) .catch(err => { diff --git a/lib/config.ts b/lib/config.ts index 31d0248..6056e0c 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -48,6 +48,7 @@ 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 7a2ee3e..71ee963 100644 --- a/lib/server.ts +++ b/lib/server.ts @@ -55,7 +55,8 @@ export function start( networkInterface, ssl, _listener, - onConnection? + onConnection?, + keepAliveTimeout: number = 0 ): void { listener = _listener; @@ -76,6 +77,7 @@ export function start( if (onConnection != null) server.on("connection", onConnection); } + if (keepAliveTimeout) server.keepAliveTimeout = keepAliveTimeout; server.listen(port, networkInterface); }