hs-clientmanager: Store the appidClientContext directly 35/25135/1
authorMarius Vlad <marius.vlad@collabora.com>
Mon, 17 Aug 2020 09:57:07 +0000 (12:57 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 19 Aug 2020 13:14:47 +0000 (16:14 +0300)
Make client related methods public to be able to call them from
other callsites.

Bug-AGL: SPEC-3524

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I7e13b83564bb6e5d49b760c27665b44d09b0ee94

src/hs-clientmanager.cpp
src/hs-clientmanager.h

index 9b62808..7c2adc5 100644 (file)
@@ -95,6 +95,8 @@ HS_ClientCtxt* HS_ClientManager::createClientCtxt(afb_req_t req, std::string app
         afb_req_session_set_LOA(req, 1);
         afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
     }
+
+    appid2ctxt[appid] = ctxt;
     return ctxt;
 }
 
@@ -186,7 +188,7 @@ int HS_ClientManager::handleRequest(afb_req_t request, const char *verb, const c
         }
         else {
             if(!strcasecmp(verb, "subscribe")) {
-                appid2ctxt[id] = createClientCtxt(request, id);
+                createClientCtxt(request, id);
                 HS_Client* client = addClient(request, id);
                 ret = client->handleRequest(request, "subscribe");
             }
index 7ca6411..96a15b9 100644 (file)
@@ -49,7 +49,6 @@ public:
     int pushEvent(const char *event, struct json_object *param, std::string appid = "");
     void removeClientCtxt(void *data);  // don't use, internal only
 
-private:
     HS_ClientCtxt* createClientCtxt(afb_req_t req, std::string appid);
     HS_Client* addClient(afb_req_t req, std::string appid);
     void removeClient(std::string appid);