From 077facba2cddd2c49d14e496dfa942c23a5e66c9 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 15 Dec 2010 18:10:12 +0000 Subject: Fix flow control for qpid-cpp-benchmark with multiple senders. Ensure senders & receivers agree on number of messages sent/received. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1049656 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/qpid-send.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cpp/src/tests/qpid-send.cpp') diff --git a/cpp/src/tests/qpid-send.cpp b/cpp/src/tests/qpid-send.cpp index e5ae6a9e4a..c71cb83f9a 100644 --- a/cpp/src/tests/qpid-send.cpp +++ b/cpp/src/tests/qpid-send.cpp @@ -291,7 +291,7 @@ int main(int argc, char ** argv) if (opts.sendRate) interval = qpid::sys::TIME_SEC/opts.sendRate; Receiver flowControlReceiver; - Address flowControlAddress(Uuid(true).str()+";{create:always}"); + Address flowControlAddress("flow-"+Uuid(true).str()+";{create:always,delete:always}"); uint flowSent = 0; if (opts.flowControl) { flowControlReceiver = session.createReceiver(flowControlAddress); @@ -322,7 +322,7 @@ int main(int argc, char ** argv) if (opts.messages && sent >= opts.messages) break; if (opts.flowControl && flowSent == 2) { - flowControlReceiver.get(Duration::SECOND*1); + flowControlReceiver.get(Duration::SECOND); --flowSent; } @@ -333,11 +333,13 @@ int main(int argc, char ** argv) } msg = Message(); // Clear out contents and properties for next iteration } + for ( ; flowSent>0; --flowSent) + flowControlReceiver.get(Duration::SECOND); if (opts.reportTotal) reporter.report(); for (uint i = opts.sendEos; i > 0; --i) { if (opts.sequence) msg.getProperties()[SN] = ++sent; - msg.setContent(EOS);//TODO: add in ability to send digest or similar + msg.setContent(EOS); //TODO: add in ability to send digest or similar sender.send(msg); } if (opts.tx) { -- cgit v1.2.1