Skip to content

Commit

Permalink
Close commandClient if primary connection is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Feb 20, 2024
1 parent 965b63c commit fc16dde
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ class Connection {

if (force) {
this.closeSubconnections();
if (this.connectionClient) {
this.connectionClient.close();
}
}

try {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1347,7 +1356,7 @@ class Connection {
this.imapClient.close();
}

if (this.commandClient && this.commandClient.usable) {
if (this.commandClient) {
this.commandClient.close();
}

Expand Down

0 comments on commit fc16dde

Please sign in to comment.