[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_1_BRANCH: kdelibs/kdecore
From:       Thiago Macieira <thiagom () mail ! com>
Date:       2003-10-26 3:24:29
[Download RAW message or body]

CVS commit by thiago: 

Backport: More fixes suggested by JohnLuck: allow reading after the 
socket was closed if the buffer socket is not empty.


  M +5 -3      kextsock.cpp   1.44.2.11


--- kdelibs/kdecore/kextsock.cpp  #1.44.2.10:1.44.2.11
@@ -1702,6 +1702,4 @@ Q_LONG KExtendedSocket::readBlock(char *
   if (d->status < connected || d->flags & passiveSocket)
     return -2;
-  if (sockfd == -1)
-    return -2;
 
   int retval;
@@ -1712,4 +1710,6 @@ Q_LONG KExtendedSocket::readBlock(char *
       // the call to the real read method
 
+      if (sockfd == -1)
+        return -2;
       if (data)
         retval = KSocks::self()->read(sockfd, data, maxlen);
@@ -1730,4 +1730,6 @@ Q_LONG KExtendedSocket::readBlock(char *
           // consumeReadBuffer returns 0 only if the buffer is
           // empty
+          if (sockfd == -1)
+            return 0;           // buffer is clear now, indicate EOF
           setError(IO_ReadError, EWOULDBLOCK);
           retval = -1;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic