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

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

CVS commit by thiago: 

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.58.2.8


--- kdelibs/kdecore/kextsock.cpp  #1.58.2.7:1.58.2.8
@@ -1402,6 +1402,4 @@ Q_LONG KExtendedSocket::readBlock(char *
   if (d->status < connected || d->flags & passiveSocket)
     return -2;
-  if (sockfd == -1)
-    return -2;
 
   int retval;
@@ -1412,4 +1410,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);
@@ -1430,4 +1430,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