diff options
author | Carl C. Trieloff <cctrieloff@apache.org> | 2007-11-12 16:36:49 +0000 |
---|---|---|
committer | Carl C. Trieloff <cctrieloff@apache.org> | 2007-11-12 16:36:49 +0000 |
commit | 85b9538691748eaadc0a67dd3e1c4e4035991ecd (patch) | |
tree | a5c8ef2f9ee62f44e7011e03299e18ec37c86f5b /cpp/src/tests/perftest.cpp | |
parent | dd893c273ab37d700ba14d8f0cf0ff76dacc6842 (diff) | |
download | qpid-python-85b9538691748eaadc0a67dd3e1c4e4035991ecd.tar.gz |
- fix for msg creation, content no longer overwrites
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@594205 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/perftest.cpp')
-rw-r--r-- | cpp/src/tests/perftest.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cpp/src/tests/perftest.cpp b/cpp/src/tests/perftest.cpp index 8e16844720..f383676da7 100644 --- a/cpp/src/tests/perftest.cpp +++ b/cpp/src/tests/perftest.cpp @@ -163,8 +163,10 @@ void PublishThread::run() { // Create test message size_t msgSize=max(opts.size, 32); - Message msg(string(msgSize, 'X'), "perftest"); - char* msgBuf = const_cast<char*>(msg.getData().data()); + char* msgBuf = new char[msgSize]; + memset(msgBuf,'X', msgSize); + + Message msg(string(), "perftest"); if (opts.durable) msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT); // Time sending message. @@ -172,6 +174,7 @@ void PublishThread::run() { if (!opts.summary) cout << "Publishing " << opts.count << " messages " << flush; for (int i=0; i<opts.count; i++) { sprintf(msgBuf, "%d", i); + msg.setData(string(msgBuf,msgSize)); session.messageTransfer(arg::destination=exchange(), arg::content=msg); if (!opts.summary && (i%10000)==0){ @@ -179,8 +182,8 @@ void PublishThread::run() { session.execution().sendSyncRequest(); } } - session.execution().sendSyncRequest(); - + delete msgBuf; + //Completion compl; if (!opts.summary) cout << " done." << endl; msg.setData("done"); // Send done messages. @@ -282,7 +285,6 @@ void ListenThread::run() { Message msg; while ((msg=consume.pop()).getData() != "done") { ++consumed; - } msg.acknowledge(); // Ack all outstanding messages -- ?? AbsTime end=now(); |