From fc16dde2adda88be18962a969fa8fb3b01461d17 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Tue, 20 Feb 2024 15:43:37 +0200 Subject: [PATCH] Close commandClient if primary connection is closed --- lib/connection.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/connection.js b/lib/connection.js index a859d927..a907c234 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -654,6 +654,9 @@ class Connection { if (force) { this.closeSubconnections(); + if (this.connectionClient) { + this.connectionClient.close(); + } } try { @@ -1124,6 +1127,9 @@ class Connection { this.logger.error({ msg: 'IMAP connection error', type: 'imapClient', previous: true, account: this.account, err }); }); this.imapClient.close(); + if (this.connectionClient) { + this.connectionClient.close(); + } } catch (err) { this.logger.error({ msg: 'IMAP close error', err }); } finally { @@ -1311,6 +1317,9 @@ class Connection { if (this.imapClient) { this.imapClient.disabled = true; this.imapClient.close(); + if (this.connectionClient) { + this.connectionClient.close(); + } } clearTimeout(this.refreshListingTimer); @@ -1347,7 +1356,7 @@ class Connection { this.imapClient.close(); } - if (this.commandClient && this.commandClient.usable) { + if (this.commandClient) { this.commandClient.close(); }