Skip to content

Commit 1b4c76b

Browse files
author
Petr Matousek
committed
explicitly release the rolled back messages due to api change
1 parent 392551a commit 1b4c76b

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/api/qpid-proton/reactor/handler/TxReceiverHandler.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,18 @@ void TxReceiverHandler::on_session_transaction_error(session &s) {
162162

163163
void TxReceiverHandler::on_session_transaction_aborted(session &s) {
164164
processed += current_batch;
165+
166+
logger(debug) << "[on_session_transaction_aborted] Transaction aborted, releasing unsettled deliveries";
167+
for (auto d : recv.unsettled_deliveries()) {
168+
d.release();
169+
}
170+
165171
current_batch = 0;
166172
logger(debug) << "[on_session_transaction_aborted] messages aborted, processed: " << processed;
167-
if (count == 0 || processed < count) {
173+
174+
if (count == 0) {
175+
s.connection().close();
176+
} else if (processed < count) {
168177
logger(info) << "[on_session_transaction_aborted] re-declaring transaction";
169178
s.transaction_declare();
170179
} else {
@@ -373,6 +382,7 @@ void TxReceiverHandler::on_message(delivery &d, message &m)
373382

374383
session s = d.session();
375384
d.accept();
385+
376386
current_batch += 1;
377387

378388
if (log_msgs == "dict") {
@@ -444,9 +454,6 @@ void TxReceiverHandler::on_message(delivery &d, message &m)
444454
s.transaction_commit();
445455
} else if (tx_action == "rollback") {
446456
s.transaction_abort();
447-
if (count == 0) {
448-
recv.connection().close();
449-
}
450457
}
451458

452459
if (tx_action == "none") {

0 commit comments

Comments
 (0)