Skip to content

Commit

Permalink
Merge pull request #140 from CliffS/master
Browse files Browse the repository at this point in the history
A few minor tweaks
  • Loading branch information
andris9 authored Mar 15, 2020
2 parents 14c2435 + b87cbf7 commit 93e42a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/smtp-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ class SMTPConnection extends EventEmitter {
.join(' ');
}

if (code >= 400) {
this.session.error = payload;
}

if (this._socket && this._socket.writable) {
this._socket.write(payload + '\r\n');
this._server.logger.debug(
Expand Down Expand Up @@ -346,6 +350,7 @@ class SMTPConnection extends EventEmitter {
return;
}

err.remote = this.remoteAddress
this._server.logger.error(
{
err,
Expand Down
5 changes: 5 additions & 0 deletions lib/smtp-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ class SMTPServer extends EventEmitter {
connection.close();
});
}
if (typeof callback === 'function') {
const realCallback = callback;
callback = null;
return realCallback();
}
}, timeout);
}

Expand Down
2 changes: 1 addition & 1 deletion test/smtp-stream-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint no-unused-expressions:0, prefer-arrow-callback: 0 */
/* globals beforeEach, describe, it */
/* globals describe, it */

'use strict';

Expand Down

0 comments on commit 93e42a1

Please sign in to comment.