diff --git a/DEPENDENCIES b/DEPENDENCIES index cc401dc..8f87b5f 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,5 +1,12 @@ # 1st Party Dependencies ## Prefer git tags instead of SHA hashes when possible. -pEpEngine=Release_2.1.23 -sequoia=365d00a08bec6a5a48d48a7c7893d78c27092b59 +# Change: +# libpEpAdapter does not specify any dependencies atm. +# libpEpAdapter is always being used as part of an adapter +# This adapter has to specify the pEpEngine version .e.g + + +# fdik: dep graph has to be taken from DEP file +# fdik: dependencies need to be resolved recursively from top to bottom +# fdik: stack then needs to be built from the bottom up diff --git a/src/Adapter.cc b/src/Adapter.cc index cb1b4c3..95e3655 100644 --- a/src/Adapter.cc +++ b/src/Adapter.cc @@ -47,7 +47,7 @@ namespace pEp { ::messageToSend_t _messageToSend = nullptr; ::notifyHandshake_t _notifyHandshake = nullptr; bool _adapter_manages_sync_thread = false; - ::inject_sync_event_t _inject_action = _queue_sync_event; + ::inject_sync_event_t _inject_action = _inject_sync_event; std::thread _sync_thread; ::utility::locked_queue sync_evt_q; std::mutex mut; @@ -78,7 +78,7 @@ namespace pEp { // std::lock_guard lock(mut); _sync_mode = mode; if (_sync_mode == SyncModes::Sync) { - // init sesssion with inject_sync = process + // init session with inject_sync = process // stop sync session(release); _inject_action = _process_sync_event; @@ -94,7 +94,7 @@ namespace pEp { // init session with inject_sync = queue // start sync thread session(release); - _inject_action = _queue_sync_event; + _inject_action = _inject_sync_event; session(init); if(!_adapter_manages_sync_thread) { if (!is_sync_running()) { @@ -113,7 +113,7 @@ namespace pEp { // Adapter needs to shutdown sync thread } session(release); - _inject_action = _queue_sync_event; + _inject_action = _inject_sync_event; session(init); } return; @@ -130,8 +130,8 @@ namespace pEp { } } - // private - int _queue_sync_event(::SYNC_EVENT ev, void *management) + // public (json adapter needs it, but should use Session mgmt from libpEpAdapter eventually) + int _inject_sync_event(::SYNC_EVENT ev, void *management) { try { if (ev == nullptr) { @@ -207,7 +207,7 @@ namespace pEp { pEpLog("called"); if (_sync_thread.joinable()) { pEpLog("sync_is_running - injecting null event"); - _queue_sync_event(nullptr, nullptr); + _inject_sync_event(nullptr, nullptr); _sync_thread.join(); } } diff --git a/src/Adapter.hh b/src/Adapter.hh index e63b34a..7ab0dcd 100644 --- a/src/Adapter.hh +++ b/src/Adapter.hh @@ -42,7 +42,7 @@ namespace pEp { void set_sync_mode(SyncModes mode); - int _queue_sync_event(::SYNC_EVENT ev, void *management); + int _inject_sync_event(::SYNC_EVENT ev, void *management); int _process_sync_event(::SYNC_EVENT ev, void *management); ::PEP_STATUS _ensure_passphrase(::PEP_SESSION session, const char *fpr); diff --git a/src/Adapter.hxx b/src/Adapter.hxx index 80f4eb2..3878b2b 100644 --- a/src/Adapter.hxx +++ b/src/Adapter.hxx @@ -97,7 +97,7 @@ namespace pEp { /* * Sync Thread Startup - * 1. ensure session for the main thread (registers: messageToSend, _queue_sync_event, _ensure_passphrase) + * 1. ensure session for the main thread (registers: messageToSend, _inject_sync_event, _ensure_passphrase) * 2. Start the sync thread * 3. Defer execution until sync thread register_sync_callbacks() has returned * 4. Throw pending exception from the sync thread @@ -120,7 +120,7 @@ namespace pEp { _notifyHandshake = notifyHandshake; } pEpLog("ensure session for the main thread"); - // 1. re-initialize session for the main thread (registers: messageToSend, _queue_sync_event, _ensure_passphrase) + // 1. re-initialize session for the main thread (registers: messageToSend, _inject_sync_event, _ensure_passphrase) session(release); session(init); diff --git a/src/pEpLog.hh b/src/pEpLog.hh index 7229ecf..2d3fae9 100644 --- a/src/pEpLog.hh +++ b/src/pEpLog.hh @@ -6,6 +6,9 @@ #include #include +#ifdef ANDROID + #include +#endif // pEpLog // ====== @@ -33,17 +36,12 @@ do { \ } while (0) #else - #ifdef ANDROID - #include - #endif - - #define pEpLog(msg) \ - do { \ - std::stringstream msg_ss; \ - msg_ss << std::this_thread::get_id() << " - " << __FILE__ << "::" << __FUNCTION__ \ - << " - " << msg; \ - pEp::Adapter::pEpLog::log(msg_ss.str()); \ - } while (0) + #define pEpLog(msg) \ + do { \ + std::stringstream msg_ss; \ + msg_ss << std::this_thread::get_id() << " - " << __FILE__ << "::" << __FUNCTION__ << " - " << msg; \ + pEp::Adapter::pEpLog::log(msg_ss.str()); \ + } while(0) #endif // NDEBUG namespace pEp {