/*
* Copyright (c) 2018 TOYOTA MOTOR CORPORATION
+ * Copyright (C) 2020 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
int HS_ClientManager::init(void)
{
+ return 0;
}
/**
if (!ctxt)
{
AFB_INFO( "create new session for %s", appid.c_str());
- HS_ClientCtxt *ctxt = new HS_ClientCtxt(appid.c_str());
+ ctxt = new HS_ClientCtxt(appid);
afb_req_session_set_LOA(req, 1);
afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
}
+
+ appid2ctxt[appid] = ctxt;
return ctxt;
}
}
}
else {
- auto ip = client_list.find(std::string(appid));
+ std::string id(appid);
+ auto ip = client_list.find(id);
if(ip != client_list.end()) {
+ // FIXME: do another verification here in case the application died
ret = ip->second->handleRequest(request, verb);
}
else {
if(!strcasecmp(verb, "subscribe")) {
- appid2ctxt[appid] = createClientCtxt(request, appid);
- HS_Client* client = addClient(request, appid);
+ createClientCtxt(request, id);
+ HS_Client* client = addClient(request, id);
ret = client->handleRequest(request, "subscribe");
}
else {
}
return 0;
-}
\ No newline at end of file
+}