Date: Tuesday, January 30, 2007 @ 15:14:31
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: BufferedSocket.cpp (1.4 -> 1.5)

Optimization for CAROB-123: fallback on non-buffered
JavaSocket::recvFully() when client wants to recv() more data than
fits in the cache.


--------------------+
 BufferedSocket.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+)


Index: carob/src/BufferedSocket.cpp
diff -u carob/src/BufferedSocket.cpp:1.4 carob/src/BufferedSocket.cpp:1.5
--- carob/src/BufferedSocket.cpp:1.4    Tue Jan 30 12:42:43 2007
+++ carob/src/BufferedSocket.cpp        Tue Jan 30 15:14:31 2007
@@ -51,6 +51,16 @@
       // new data.
       flush();
 
+      if (remainingBytesToRead > READ_BUFFER_SIZE-1)
+        // 1. our read cache is empty
+        // 2. we add a memcpy()
+        // 3. our recv(READ_BUFFER_SIZE) would be LESS eager that the
+        //    non-buffered one!
+        // => our purpose is defeated, let's give up and let the
+        //    simpler, NON-buffered code do the job
+        return alreadyRead
+          + JavaSocket::recvFully(static_cast<java_byte*>(buf)+alreadyRead, 
remainingBytesToRead, flags);
+
       availableBytes = fillReadBuffer(flags);
     }
     

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

Reply via email to