diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2017-03-15 14:58:55 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2017-03-15 15:12:52 +0000 |
commit | e1f576bdb38f9cf63f1c74cde55afdd25d7b96ed (patch) | |
tree | 3611c9c5db3f1a6bbf83c3c51c9a3c22797278e6 /wsd/Admin.hpp | |
parent | Adjust initial AdminRequestHandler entry point. (diff) | |
download | online-e1f576bdb38f9cf63f1c74cde55afdd25d7b96ed.tar.gz online-e1f576bdb38f9cf63f1c74cde55afdd25d7b96ed.zip |
Switch to using websocket here.
Diffstat (limited to 'wsd/Admin.hpp')
-rw-r--r-- | wsd/Admin.hpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/wsd/Admin.hpp b/wsd/Admin.hpp index 82b5a5ec7f..c15cbbb818 100644 --- a/wsd/Admin.hpp +++ b/wsd/Admin.hpp @@ -24,14 +24,17 @@ #include "Log.hpp" #include <LOOLWebSocket.hpp> +#include "net/WebSocketHandler.hpp" + class Admin; -class StreamSocket; -/// Admin requests over HTTP(S) handler. -class AdminRequestHandler /// public Poco::Net::HTTPRequestHandler +/// Handle admin client's Websocket requests & replies. +class AdminRequestHandler : public WebSocketHandler { public: - AdminRequestHandler(Admin* adminManager); + AdminRequestHandler(Admin* adminManager, + const std::weak_ptr<StreamSocket>& socket, + const Poco::Net::HTTPRequest& request); static void handleInitialRequest(const std::weak_ptr<StreamSocket> &socket, const Poco::Net::HTTPRequest& request); @@ -41,11 +44,12 @@ private: void sendTextFrame(const std::string& message); - bool adminCommandHandler(const std::vector<char>& payload); + /// Process incoming websocket messages + void handleMessage(bool fin, WSOpCode code, std::vector<char> &data); private: Admin* _admin; - std::shared_ptr<LOOLWebSocket> _adminWs; +// std::shared_ptr<LOOLWebSocket> _adminWs; FIXME - this is us now ! int _sessionId; bool _isAuthenticated; }; @@ -55,6 +59,7 @@ class MemoryStatsTask; /// An admin command processor. class Admin { + Admin(); public: virtual ~Admin(); @@ -91,20 +96,12 @@ public: void rescheduleCpuTimer(unsigned interval); - static AdminRequestHandler* createRequestHandler() - { - return new AdminRequestHandler(&instance()); - } - std::unique_lock<std::mutex> getLock() { return std::unique_lock<std::mutex>(_modelMutex); } void updateLastActivityTime(const std::string& docKey); void updateMemoryDirty(const std::string& docKey, int dirty); private: - Admin(); - -private: AdminModel _model; std::mutex _modelMutex; int _forKitPid; |