[Libreoffice-commits] online.git: Branch 'private/Ashod/nonblocking' - net/clientnb.cpp net/loolnb.cpp

Michael Meeks michael.meeks at collabora.com
Thu Feb 16 11:24:37 UTC 2017


 net/clientnb.cpp |    3 ++-
 net/loolnb.cpp   |    7 +++----
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit de41fffde6cfeaebdc85a060e2ed8ef92e539a85
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Feb 16 11:24:07 2017 +0000

    Get number response / ping bits working.

diff --git a/net/clientnb.cpp b/net/clientnb.cpp
index a8ec054..87ee8b5 100644
--- a/net/clientnb.cpp
+++ b/net/clientnb.cpp
@@ -91,6 +91,7 @@ struct Session
 
             std::string result(std::istreambuf_iterator<char>(responseStream), {});
             std::cerr << "Got response '" << result << "'\n";
+            number = std::stoi(result);
         }
         catch (const Poco::Exception &e)
         {
@@ -118,7 +119,7 @@ public:
         assert (back == count + 1);
 
         back = second.getResponse();
-        assert (back == count + 1);
+        assert (back == count + 2);
 
         return 0;
     }
diff --git a/net/loolnb.cpp b/net/loolnb.cpp
index 963a631..7c4f23f 100644
--- a/net/loolnb.cpp
+++ b/net/loolnb.cpp
@@ -58,20 +58,19 @@ public:
         // complex algorithmic core:
         number = number + 1;
 
+        std::string numberString = std::to_string(number);
         std::ostringstream oss;
         oss << "HTTP/1.1 200 OK\r\n"
             << "Date: Once, Upon a time GMT\r\n" // Mon, 27 Jul 2009 12:28:53 GMT
             << "Server: madeup string (Linux)\r\n"
-            << "Content-Length: " << _inBuffer.size() << "\r\n"
+            << "Content-Length: " << numberString.size() << "\r\n"
             << "Content-Type: text/plain\r\n"
             << "Connection: Closed\r\n"
             << "\r\n"
+            << numberString;
             ;
         std::string str = oss.str();
         _outBuffer.insert(_outBuffer.end(), str.begin(), str.end());
-
-        // append the content we got:
-        _outBuffer.insert(_outBuffer.end(), _inBuffer.begin(), _inBuffer.end());
         _inBuffer.clear();
     }
 };


More information about the Libreoffice-commits mailing list