You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/08/02 17:45:45 UTC

svn commit: r1368556 - in /incubator/etch/trunk/binding-cpp/runtime/src/main/transport: EtchDefaultDeliveryService.cpp EtchPacketizer.cpp

Author: veithm
Date: Thu Aug  2 15:45:44 2012
New Revision: 1368556

URL: http://svn.apache.org/viewvc?rev=1368556&view=rev
Log:
ETCH-180 Fixed some minor bugs in packetizer

Change-Id: Id4cea52d7cf5b7e8df6b48d66cb0d65466995553

Modified:
    incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp?rev=1368556&r1=1368555&r2=1368556&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp Thu Aug  2 15:45:44 2012
@@ -168,7 +168,12 @@ status_t EtchDefaultDeliveryService::end
   //get response field
   capu::SmartPointer<EtchObject> r;
   EtchField field = responseType->getResponseField();
-  if (rmsg->get(field, &r) != ETCH_OK) {
+  status_t err = rmsg->get(field, &r);
+  if (err == ETCH_ENOT_EXIST) {
+    //void return value
+    mb->closeRead();
+    return ETCH_OK;
+  } else if (err != ETCH_OK) {
     mb->closeRead();
     rmsg->clear();
     delete mbe;

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp?rev=1368556&r1=1368555&r2=1368556&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp Thu Aug  2 15:45:44 2012
@@ -134,6 +134,8 @@ status_t EtchPacketizer::transportPacket
 }
 
 status_t EtchPacketizer::sessionData(capu::SmartPointer<EtchWho> sender, capu::SmartPointer<EtchFlexBuffer> buf) {
+//TODO: compare with java version
+
 
   // there are two options here. one is that we have no buffered data
   // and the entire packet is contained within the buf. in that case
@@ -141,7 +143,7 @@ status_t EtchPacketizer::sessionData(cap
   // drop the packet on the handler.
 
   status_t result;
-  while (buf->getAvailableBytes() > 0) {
+  if (buf->getAvailableBytes() > 0) {
     if (mWantHeader) {
       // do we have enough to make a header?
 
@@ -167,9 +169,6 @@ status_t EtchPacketizer::sessionData(cap
             return result;
         }
 
-        if (pktSize == 0)
-          continue;
-
         mBodyLen = pktSize;
         mWantHeader = false;
       } else // want header, but there's not enough to make it.
@@ -179,7 +178,8 @@ status_t EtchPacketizer::sessionData(cap
         mSavedBuf->setIndex(mSavedBuf->getLength());
         mSavedBuf->put(*buf);
       }
-    } else if (mSavedBuf->getLength() + buf->getAvailableBytes() >= mBodyLen) {
+    }
+    if (!mWantHeader && mSavedBuf->getLength() + buf->getAvailableBytes() >= mBodyLen) {
       // want body, and there's enough to make it.
 
       // three possible cases: the body is entirely in savedBuf,
@@ -213,9 +213,10 @@ status_t EtchPacketizer::sessionData(cap
         mSavedBuf->reset();
         mWantHeader = true;
       }
-    } else // want body, but there's not enough to make it.
+    } else if (!mWantHeader)// want body, but there's not enough to make it.
     {
       // save buf in savedBuf.
+      mSavedBuf->setIndex(mSavedBuf->getLength());
       mSavedBuf->put(*buf);
     }
   }