Skip to content

Commit 4dbb900

Browse files
author
Petr Matousek
committed
credit handling fix
1 parent 368c848 commit 4dbb900

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,13 @@ void TxReceiverHandler::on_session_open(session &s) {
138138
s.transaction_declare(*this);
139139
} else {
140140
logger(trace) << "[on_session_open] Transaction is declared: " << s.transaction_id();
141+
if (count != 0 && (processed + batch_size > count)) {
142+
batch_size = count % batch_size;
143+
} else if (count == 0) {
144+
batch_size = 1;
145+
}
141146
recv.add_credit(batch_size);
142147
logger(debug) << "[on_session_open] Receiver credit: " << recv.credit();
143-
if (count != 0 && processed + batch_size > count) {
144-
batch_size = count % batch_size;
145-
}
146148
}
147149
}
148150

0 commit comments

Comments
 (0)