[Libreoffice-commits] online.git: 3 commits - loolwsd/ChildProcessSession.cpp loolwsd/IoUtil.cpp loolwsd/LOOLBroker.cpp

Tor Lillqvist tml at collabora.com
Mon Apr 4 12:48:08 UTC 2016


 loolwsd/ChildProcessSession.cpp |   19 +++++++++++--------
 loolwsd/IoUtil.cpp              |   10 ++++++++--
 loolwsd/LOOLBroker.cpp          |    3 +++
 3 files changed, 22 insertions(+), 10 deletions(-)

New commits:
commit 321b244eb3ca76d70efb1e9a31cd8375f8b01531
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Apr 4 14:21:04 2016 +0300

    Catch also NetException in SocketProcessor()
    
    Doesn't seem to fix anything, but probably is a good idea to not let
    such an exception propagate, but treat it as the connection closing.

diff --git a/loolwsd/IoUtil.cpp b/loolwsd/IoUtil.cpp
index 4a8b26f..f1e6a05 100644
--- a/loolwsd/IoUtil.cpp
+++ b/loolwsd/IoUtil.cpp
@@ -29,11 +29,13 @@
 #include "IoUtil.hpp"
 #include "Util.hpp"
 
-namespace IoUtil
-{
+using Poco::Net::NetException;
 using Poco::Net::WebSocket;
 using Poco::Net::WebSocketException;
 
+namespace IoUtil
+{
+
 // Synchronously process WebSocket requests and dispatch to handler.
 // Handler returns false to end.
 void SocketProcessor(std::shared_ptr<WebSocket> ws,
@@ -187,6 +189,10 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws,
             break;
         }
     }
+    catch (const NetException& exc)
+    {
+        Log::error("SocketProcessor: NetException: " + exc.message());
+    }
 
     Log::info(name + "Finished Socket Processor.");
 }
commit bbb4355e7373e5efe61d3aef3ec82fbe409b5592
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Apr 4 14:20:20 2016 +0300

    Output also a trace in DocumentCallback

diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index 8f69671..acdd6d0 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -661,6 +661,9 @@ private:
 
     static void DocumentCallback(int nType, const char* pPayload, void* pData)
     {
+        Log::trace() << "Document::DocumentCallback "
+                     << LOKitHelper::kitCallbackTypeToString(nType)
+                     << " [" << (pPayload ? pPayload : "") << "]." << Log::end;
         Document* self = reinterpret_cast<Document*>(pData);
         if (self)
         {
commit b622b5ea2ee76846cd4d4d3c505b678bbf900c76
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Apr 4 13:29:02 2016 +0300

    Use 'using' consistenly

diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index 32bd228..110d06a 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -31,6 +31,7 @@
 
 using namespace LOOLProtocol;
 
+using Poco::AutoPtr;
 using Poco::Exception;
 using Poco::JSON::Object;
 using Poco::JSON::Parser;
@@ -38,13 +39,15 @@ using Poco::Net::WebSocket;
 using Poco::Notification;
 using Poco::NotificationQueue;
 using Poco::Path;
+using Poco::Runnable;
 using Poco::StringTokenizer;
+using Poco::Timestamp;
 using Poco::URI;
 
-class CallbackNotification: public Poco::Notification
+class CallbackNotification: public Notification
 {
 public:
-    typedef Poco::AutoPtr<CallbackNotification> Ptr;
+    typedef AutoPtr<CallbackNotification> Ptr;
 
     CallbackNotification(const int nType, const std::string& rPayload)
       : _nType(nType),
@@ -57,7 +60,7 @@ public:
 };
 
 /// This thread handles callbacks from the lokit instance.
-class CallbackWorker: public Poco::Runnable
+class CallbackWorker: public Runnable
 {
 public:
     CallbackWorker(NotificationQueue& queue, ChildProcessSession& session):
@@ -249,7 +252,7 @@ private:
 std::recursive_mutex ChildProcessSession::Mutex;
 
 ChildProcessSession::ChildProcessSession(const std::string& id,
-                                         std::shared_ptr<Poco::Net::WebSocket> ws,
+                                         std::shared_ptr<WebSocket> ws,
                                          LibreOfficeKitDocument * loKitDocument,
                                          const std::string& jailId,
                                          std::function<LibreOfficeKitDocument*(const std::string&, const std::string&, const std::string&, bool)> onLoad,
@@ -296,7 +299,7 @@ void ChildProcessSession::disconnect(const std::string& reason)
     }
 }
 
-bool ChildProcessSession::handleDisconnect(Poco::StringTokenizer& tokens)
+bool ChildProcessSession::handleDisconnect(StringTokenizer& tokens)
 {
     return LOOLSession::handleDisconnect(tokens);
 }
@@ -574,7 +577,7 @@ void ChildProcessSession::sendFontRendering(const char* /*buffer*/, int /*length
     output.resize(response.size());
     std::memcpy(output.data(), response.data(), response.size());
 
-    Poco::Timestamp timestamp;
+    Timestamp timestamp;
     int width, height;
     unsigned char *pixmap = _loKitDocument->pClass->renderFont(_loKitDocument, decodedFont.c_str(), &width, &height);
     Log::trace("renderFont [" + font + "] rendered in " + std::to_string(timestamp.elapsed()/1000.) + "ms");
@@ -691,7 +694,7 @@ void ChildProcessSession::sendTile(const char* /*buffer*/, int /*length*/, Strin
         _loKitDocument->pClass->setPart(_loKitDocument, part);
     }
 
-    Poco::Timestamp timestamp;
+    Timestamp timestamp;
     _loKitDocument->pClass->paintTile(_loKitDocument, pixmap.data(), width, height, tilePosX, tilePosY, tileWidth, tileHeight);
     Log::trace() << "paintTile at [" << tilePosX << ", " << tilePosY
                  << "] rendered in " << (timestamp.elapsed()/1000.) << " ms" << Log::end;
@@ -798,7 +801,7 @@ void ChildProcessSession::sendCombinedTiles(const char* /*buffer*/, int /*length
 
     std::vector<unsigned char> pixmap(pixmapSize, 0);
 
-    Poco::Timestamp timestamp;
+    Timestamp timestamp;
     _loKitDocument->pClass->paintTile(_loKitDocument, pixmap.data(), pixmapWidth, pixmapHeight,
                                       renderArea.getLeft(), renderArea.getTop(),
                                       renderArea.getWidth(), renderArea.getHeight());


More information about the Libreoffice-commits mailing list