Skip to content

Commit

Permalink
connection: assure remote is connected before queue (#3338)
Browse files Browse the repository at this point in the history
- immediately before queuing, check that remote is still connected
  • Loading branch information
msimerson committed Apr 30, 2024
1 parent e9ffa35 commit b888217
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#### Changed

- bounce: repackaged plugin as NPM module #3341
- connection: check remote is connected before queue #3338
- transaction: init with conn.init_transaction, always pass in cfg #3315
- check for local_mx only when default route is used #3307
- dkim: repackaged as NPM module #3311
Expand Down
5 changes: 2 additions & 3 deletions connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

// node.js built-in libs
const dns = require('dns');
const fs = require('fs');
const net = require('net');
const os = require('os');
const path = require('path');

// npm libs
const ipaddr = require('ipaddr.js');
Expand Down Expand Up @@ -1738,6 +1736,7 @@ class Connection {
}
}
queue_outbound_respond (retval, msg) {
if (this.remote.closed) return;
if (!msg) msg = this.queue_msg(retval, msg) || 'Message Queued';
this.store_queue_result(retval, msg);
msg = `${msg} (${this.transaction.uuid})`;
Expand Down Expand Up @@ -1894,4 +1893,4 @@ exports.createConnection = (client, server, cfg) => {
return new Connection(client, server, cfg);
}

logger.add_log_methods(Connection)
logger.add_log_methods(Connection)
1 change: 1 addition & 0 deletions plugins/queue/smtp_forward.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ exports.forward_enabled = function (conn, dom_cfg) {

exports.queue_forward = function (next, connection) {
const plugin = this;
if (connection.remote.closed) return
const txn = connection?.transaction;

const cfg = plugin.get_config(connection);
Expand Down

0 comments on commit b888217

Please sign in to comment.