@ -29,6 +29,13 @@ PEP_SESSION SessionRegistry::get(std::thread::id tid)
throw std::runtime_error("init() fails: " + pEp::status_to_string(status) );
}
m[tid] = session;
Log.debug("Apply %zu cached config values to new session.", cache.size());
for(const auto& e : cache)
{
Log.debug("\t %s", e.first.c_str());
e.second(session);
Log.debug("get() created new session at %p.", (const void*)session);
return session;
@ -4,6 +4,7 @@
#include <map>
#include <mutex>
#include <thread>
#include <functional>
#include <pEp/pEpEngine.h>
class SessionRegistry
@ -31,6 +32,7 @@ private:
std::map<std::thread::id, PEP_SESSION> m;
messageToSend_t mts;
inject_sync_event_t ise;
std::map<std::string, std::function<void(PEP_SESSION)>> cache;
typedef std::recursive_mutex Mutex;
typedef std::unique_lock<Mutex> Lock;