[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp
Henry Castro
hcastro at collabora.com
Sun Feb 14 18:33:37 UTC 2016
loolwsd/LOOLKit.cpp | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
New commits:
commit 42abb3b1a73d7aeb0280389ca2c28bb041de2039
Author: Henry Castro <hcastro at collabora.com>
Date: Sun Feb 14 14:32:55 2016 -0400
loolwsd: websocket shutdown receive
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 5655a8c..6f1fc63 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -40,6 +40,7 @@
#include <Poco/Notification.h>
#include <Poco/Mutex.h>
#include <Poco/Util/ServerApplication.h>
+#include <Poco/Net/NetException.h>
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKitInit.h>
@@ -338,17 +339,24 @@ public:
// Destroy all connections and views.
for (auto aIterator : _connections)
{
- if (TerminationState == LOOLState::LOOL_ABNORMAL)
+ try
{
// stop all websockets
- std::shared_ptr<WebSocket> ws = aIterator.second->getWebSocket();
- if ( ws )
- ws->shutdownReceive();
+ if (aIterator.second->isRunning())
+ {
+ std::shared_ptr<WebSocket> ws = aIterator.second->getWebSocket();
+ if ( ws )
+ {
+ ws->shutdownReceive();
+ aIterator.second->join();
+ }
+ }
}
- else
+ catch(Poco::Net::NetException& exc)
{
- // wait until loolwsd close all websockets
- aIterator.second->join();
+ Log::error() << "Error: " << exc.displayText()
+ << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
+ << Log::end;
}
}
More information about the Libreoffice-commits
mailing list