From 2e093926276cd46bfb56cfcbdbc8b280a376d151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Majdand=C5=BEi=C4=87?= Date: Mon, 27 Mar 2023 16:40:54 +0200 Subject: [PATCH] Fix issue where client sessions were closed without status updates --- main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.js b/main.js index 5080da9..e10f256 100644 --- a/main.js +++ b/main.js @@ -212,6 +212,7 @@ class ClientSession { auto_enquire_link_period: this.auto_enquire_link_period, }, this.connected.bind(this)); this.session.on('error', this.error.bind(this)); + this.session.on('close', this.closed.bind(this)); } catch (e) { this.logger.log1("Client connection failed to " + this.url); this.setStatus(ClientSessionStatus.NOT_CONNECTED); @@ -224,6 +225,11 @@ class ClientSession { return this.connectingPromise.promise; } + closed() { + this.logger.log1(`Client closed connection to ${this.url}`); + this.setStatus(ClientSessionStatus.NOT_CONNECTED); + } + error(error) { if (error.code === "ETIMEOUT") { this.logger.log1("Client connection timed out to " + this.url);