Browse Source

providing passphrase_cache

synchronous
Volker Birk 5 years ago
parent
commit
753a789a18
  1. 4
      callback_dispatcher.cc
  2. 1
      callback_dispatcher.hh
  3. 2
      passphrase_cache.cc
  4. 2
      passphrase_cache.hh

4
callback_dispatcher.cc

@ -1,4 +1,5 @@
#include "callback_dispatcher.hh" #include "callback_dispatcher.hh"
#include "passphrase_cache.hh"
#include <stdexcept> #include <stdexcept>
#include <cassert> #include <cassert>
@ -87,6 +88,9 @@ namespace pEp {
PEP_STATUS CallbackDispatcher::_messageToSend(::message *msg) PEP_STATUS CallbackDispatcher::_messageToSend(::message *msg)
{ {
if (Adapter::on_sync_thread() && !msg)
return PassphraseCache::messageToSend(passphrase_cache, Adapter::session());
for (auto target : targets) { for (auto target : targets) {
::message *_msg = nullptr; ::message *_msg = nullptr;
if (msg) { if (msg) {

1
callback_dispatcher.hh

@ -36,7 +36,6 @@ namespace pEp {
static PEP_STATUS messageToSend(::message *msg); static PEP_STATUS messageToSend(::message *msg);
static PEP_STATUS notifyHandshake(::pEp_identity *me, static PEP_STATUS notifyHandshake(::pEp_identity *me,
::pEp_identity *partner, ::sync_handshake_signal signal); ::pEp_identity *partner, ::sync_handshake_signal signal);
protected: protected:
void on_startup(); void on_startup();
void on_shutdown(); void on_shutdown();

2
passphrase_cache.cc

@ -1,6 +1,8 @@
#include <cassert> #include <cassert>
#include "passphrase_cache.hh" #include "passphrase_cache.hh"
pEp::PassphraseCache pEp::passphrase_cache;
namespace pEp { namespace pEp {
PassphraseCache::cache_entry::cache_entry(const std::string& p, time_point t) : PassphraseCache::cache_entry::cache_entry(const std::string& p, time_point t) :
passphrase{p, 0, PassphraseCache::cache_entry::max_len}, tp{t} passphrase{p, 0, PassphraseCache::cache_entry::max_len}, tp{t}

2
passphrase_cache.hh

@ -87,6 +87,8 @@ namespace pEp {
void cleanup(); void cleanup();
void refresh(cache::iterator entry); void refresh(cache::iterator entry);
}; };
extern PassphraseCache passphrase_cache;
}; };
#include "passphrase_cache.hxx" #include "passphrase_cache.hxx"

Loading…
Cancel
Save