Date: Tuesday, February 21, 2006 @ 17:10:27
  Author: gilles
    Path: /cvsroot/carob/carob/src

Modified: JavaSocket.cpp (1.40 -> 1.41)

Fixed bug when connection is reset by remote peer => now return the error (in 
recv) instead on looping endlessly on data retrieval


----------------+
 JavaSocket.cpp |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)


Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.40 carob/src/JavaSocket.cpp:1.41
--- carob/src/JavaSocket.cpp:1.40       Tue Feb 14 18:35:47 2006
+++ carob/src/JavaSocket.cpp    Tue Feb 21 17:10:27 2006
@@ -336,7 +336,7 @@
                             ((static_cast<uint8_t*>(buf))+alreadyRead)),
                         len-alreadyRead,
                         flags);
-    if (readThisTime < 0)
+    if (readThisTime <= 0)
     {
       //this is an error
       return readThisTime;
@@ -367,18 +367,13 @@
   int status = recvFully(buf, len, flags);
   if (status == -1)
   {
-    throw SocketIOException(fctName + L"Could not read int from socket.");
-    return false;
+    throw SocketIOException(fctName + L"Could not read from socket.");
   }
-  else if (status == 0) // FIXME: recvFully currently does not return 0
+  else if (status == 0)
   {
     throw SocketIOException(fctName + L"Peer reset connection while reading 
integer.");
-    return false;
-  }
-  else
-  {
-    return true;
   }
+  return true;
 }
 
 const uint64_t JavaSocket::ntohll(const uint64_t &n) const

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

Reply via email to