Date: Thursday, February 23, 2006 @ 12:09:56
  Author: zsolt
    Path: /cvsroot/carob/carob

Modified: include/DriverSocket.hpp (1.12 -> 1.13) src/DriverSocket.cpp
          (1.16 -> 1.17)

fragment long strings into STRING_CHUNK_SIZE and send it to the controller this 
way.
Reference: CAROB-67


--------------------------+
 include/DriverSocket.hpp |    2 ++
 src/DriverSocket.cpp     |    8 +++-----
 2 files changed, 5 insertions(+), 5 deletions(-)


Index: carob/include/DriverSocket.hpp
diff -u carob/include/DriverSocket.hpp:1.12 carob/include/DriverSocket.hpp:1.13
--- carob/include/DriverSocket.hpp:1.12 Wed Jan 25 17:01:59 2006
+++ carob/include/DriverSocket.hpp      Thu Feb 23 12:09:56 2006
@@ -26,6 +26,8 @@
 
 namespace CarobNS {
 
+const int STRING_CHUNK_SIZE = 64000/3;
+
 /**
  * Higher level class for socket.
  * Defines handy methods to read/write to/from a controller following
Index: carob/src/DriverSocket.cpp
diff -u carob/src/DriverSocket.cpp:1.16 carob/src/DriverSocket.cpp:1.17
--- carob/src/DriverSocket.cpp:1.16     Wed Feb 15 11:03:42 2006
+++ carob/src/DriverSocket.cpp  Thu Feb 23 12:09:56 2006
@@ -44,12 +44,10 @@
   *this<<true;
   size_t strLen = s.size();
   *this<<static_cast<int32_t>(strLen);
-  size_t totalWritten = 0;
   // FIXME: catch CodecException here
-  while (totalWritten < strLen)
-  {
-    totalWritten += writeJavaUTF(s);
-  }
+  for (size_t idx=0; idx < strLen; idx+=STRING_CHUNK_SIZE)
+    writeJavaUTF(s.substr(idx, STRING_CHUNK_SIZE));
+
   return *this;
 }
 

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to