Browse Source

more log output. *sigh*

JSON-155
Roker 2 years ago
parent
commit
437b5fadc1
3 changed files with 8 additions and 2 deletions
  1. +2
    -2
      server/ev_server.cc
  2. +5
    -0
      server/function_map.hh
  3. +1
    -0
      server/session_registry.cc

+ 2
- 2
server/ev_server.cc View File

@ -87,8 +87,8 @@ const FunctionMap functions = {
// FP( "get_phrase" , new Func<PEP_STATUS, In_Pep_Session, In<Language>, In<int>, Out<char*>> ( &get_phrase) ),
// FP( "get_engine_version", new Func<const char*> ( &get_engine_version) ),
FP( "is_pEp_user" , new Func<PEP_STATUS, In_Pep_Session, In<pEp_identity*>, Out<bool>>( &is_pEp_user) ),
FP( "config_passive_mode", new FuncCache<void, In_Pep_Session, In<bool>>( "..", &config_passive_mode) ),
FP( "config_unencrypted_subject", new FuncCache<void, In_Pep_Session, In<bool>>( "..", &config_unencrypted_subject) ),
FP( "config_passive_mode", new FuncCache<void, In_Pep_Session, In<bool>>( "conf_p_m", &config_passive_mode) ),
FP( "config_unencrypted_subject", new FuncCache<void, In_Pep_Session, In<bool>>( "conf_u_s", &config_unencrypted_subject) ),
FP( "Identity Management API", new Separator),
FP( "get_identity" , new Func<PEP_STATUS, In_Pep_Session, In<c_string>, In<c_string>, Out<pEp_identity*>>( &get_identity) ),


+ 5
- 0
server/function_map.hh View File

@ -7,6 +7,7 @@
#include "json_spirit/json_spirit_writer.h"
#include "context.hh"
#include "logger.hh"
#include <type_traits>
// Just for debugging:
@ -223,11 +224,15 @@ public:
js::Value call(const js::Array& parameters, Context* context) const override
{
Logger Log("FuncCache::call");
typedef std::tuple<typename Args::c_type...> param_tuple_t;
param_tuple_t param_tuple;
// FIXME: Does only work with functions with type: void(PEP_SESSION, T):
const auto p0 = from_json< typename std::tuple_element<1, param_tuple_t>::type >(parameters[0]);
Log << Logger::Debug << "func_name=\"" << func_name << "\", value=" << p0 << ".";
std::function<void(PEP_SESSION)> func = std::bind(Base::fn, std::placeholders::_1, p0);
context->cache(func_name, func);
return Base::call(parameters, context);


+ 1
- 0
server/session_registry.cc View File

@ -64,6 +64,7 @@ void SessionRegistry::for_each(void(*function)(PEP_SESSION))
void SessionRegistry::add_to_cache(const std::string& fn_name, const std::function<void(PEP_SESSION)>& func)
{
Lock L(_mtx);
Log.debug("add_to_cache(\"%s\")", fn_name.c_str());
cache[fn_name] = func;
}


Loading…
Cancel
Save