::waitForText handling for disconnected sockets
authorAlex Kirhenshtein <alk@netxms.org>
Mon, 15 Apr 2013 20:59:29 +0000 (20:59 +0000)
committerAlex Kirhenshtein <alk@netxms.org>
Mon, 15 Apr 2013 20:59:29 +0000 (20:59 +0000)
src/libnetxms/net.cpp

index 7e3b5c2..3e305f3 100644 (file)
@@ -180,6 +180,11 @@ bool SocketConnection::waitForText(const char *text, int timeout)
                }
 
                int size = read(&m_data[m_dataPos], 4095 - m_dataPos);
+      if (size <= 0)
+      {
+         return false;
+      }
+
                m_data[size + m_dataPos] = 0;
                bufLen = (int)strlen(m_data);