[Libreoffice-commits] online.git: loolwsd/Connect.cpp

Tor Lillqvist tml at collabora.com
Thu Apr 14 14:47:17 UTC 2016


 loolwsd/Connect.cpp |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit fe5f238c0885f272daaf78346ce6c881ace11033
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Apr 14 17:45:46 2016 +0300

    Exit when receiving an *unexpected* CLOSE frame
    
    Otherwise we will just keep waiting for a line on input from stdin,
    which is unhelpful.

diff --git a/loolwsd/Connect.cpp b/loolwsd/Connect.cpp
index 7f0bf83..b7c5c70 100644
--- a/loolwsd/Connect.cpp
+++ b/loolwsd/Connect.cpp
@@ -67,6 +67,8 @@ using Poco::Thread;
 using Poco::URI;
 using Poco::Util::Application;
 
+static bool closeExpected = false;
+
 class Output: public Runnable
 {
 public:
@@ -108,6 +110,8 @@ public:
             }
             while (n > 0 && (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE);
             std::cout << "CLOSE frame received" << std::endl;
+            if (!closeExpected)
+                std::_Exit(Application::EXIT_SOFTWARE);
         }
         catch (WebSocketException& exc)
         {
@@ -116,7 +120,6 @@ public:
     }
 
     WebSocket& _ws;
-
 };
 
 class Connect: public Poco::Util::Application
@@ -192,6 +195,7 @@ protected:
         }
 
         std::cout << "Shutting down websocket" << std::endl;
+        closeExpected = true;
         ws.shutdown();
         thread.join();
 


More information about the Libreoffice-commits mailing list