Skip to content

Commit

Permalink
fix: fixed callback invocations to check if session already closed (#705
Browse files Browse the repository at this point in the history
)
  • Loading branch information
titanism authored Jul 29, 2024
1 parent 4ef3eaa commit d06071b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/pop3/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,11 @@ class POP3Connection extends EventEmitter {
}

this._server.onFetchMessage(message, this.session, (err, stream) => {
if (!this.session) {
// already closed, do nothing
return;
}

if (err) {
this._server.loggelf({
short_message: '[POP3RETR] error',
Expand Down Expand Up @@ -810,6 +815,11 @@ class POP3Connection extends EventEmitter {
}

this._server.onFetchMessage(message, this.session, (err, stream) => {
if (!this.session) {
// already closed, do nothing
return;
}

if (err) {
this._server.loggelf({
short_message: '[POP3TOP] error',
Expand Down Expand Up @@ -1002,6 +1012,11 @@ class POP3Connection extends EventEmitter {

openMailbox(next) {
this._server.onListMessages(this.session, (err, listing) => {
if (!this.session) {
// already closed, do nothing
return;
}

if (err) {
this.logger.info(
{
Expand Down

0 comments on commit d06071b

Please sign in to comment.