[Libreoffice-commits] online.git: Branch 'private/Ashod/nonblocking' - net/socket.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Feb 20 03:51:51 UTC 2017


 net/socket.hpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 26ff81539c21e7c63ca336377e80c13d0fe70f2e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Feb 19 12:32:07 2017 -0500

    nb: the last item in the read buffer is sentinel
    
    Change-Id: I13d80a8d436c188dbfa558ddf8fbc7c1a3a6567e
    Reviewed-on: https://gerrit.libreoffice.org/34444
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/net/socket.hpp b/net/socket.hpp
index 6f7686b..a88f98d 100644
--- a/net/socket.hpp
+++ b/net/socket.hpp
@@ -320,6 +320,7 @@ public:
     }
 
     /// Reads data by invoking readData() and buffering.
+    /// Return false iff the socket is closed.
     virtual bool readIncomingData()
     {
         ssize_t len;
@@ -330,7 +331,7 @@ public:
             // TODO: Cap the buffer size, lest we grow beyond control.
             do
             {
-                len = readData(buf, sizeof(buf));
+                len = readData(buf, sizeof(buf) - 1);
             }
             while (len < 0 && errno == EINTR);
 


More information about the Libreoffice-commits mailing list