You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cc...@apache.org on 2007/11/12 17:36:50 UTC

svn commit: r594205 - /incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp

Author: cctrieloff
Date: Mon Nov 12 08:36:49 2007
New Revision: 594205

URL: http://svn.apache.org/viewvc?rev=594205&view=rev
Log:
- fix for msg creation, content no longer overwrites


Modified:
    incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp?rev=594205&r1=594204&r2=594205&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp Mon Nov 12 08:36:49 2007
@@ -163,8 +163,10 @@
 
         // 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 @@
         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 @@
                  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 @@
         Message msg;
         while ((msg=consume.pop()).getData() != "done") {
             ++consumed;
-
         }
         msg.acknowledge();      // Ack all outstanding messages -- ??
         AbsTime end=now();