adapt to new JSON adapter

unblock Startup(), see code comment why
COM-121
Volker Birk 2 years ago
parent 6980901369
commit d93891db60
  1. 8
      CpEpEngine.cpp
  2. 6
      LocalJSONAdapter.cpp
  3. 1
      LocalJSONAdapter.h

@ -1835,7 +1835,13 @@ STDMETHODIMP CpEpEngine::Startup()
{
try
{
pEp::CallbackDispatcher::start_sync();
// this must be unblocked, because it's not possible to have two API calls in parallel
// start_sync() may send notifyHandshake() to ask for a passphrase; when this happens
// the client needs to call ConfigPassphrase() while the startup process is being executed
// so we need to return from Startup() immediately to make this possible
auto sync_starter_thread = std::thread(pEp::CallbackDispatcher::start_sync);
sync_starter_thread.detach();
}
catch (bad_alloc&) {
return E_OUTOFMEMORY;

@ -1,9 +1,15 @@
#include "stdafx.h"
#include "LocalJSONAdapter.h"
#include <pEp/Adapter.hh>
void startSync() { }
void stopSync() { }
std::thread::id LocalJSONAdapter::get_sync_thread_id() const
{
return pEp::Adapter::sync_thread_id();
}
LocalJSONAdapter& LocalJSONAdapter::createInstance()
{
return dynamic_cast<LocalJSONAdapter&>(JsonAdapter::createInstance(new LocalJSONAdapter()));

@ -7,6 +7,7 @@ class LocalJSONAdapter :
{
public:
static LocalJSONAdapter& createInstance();
std::thread::id get_sync_thread_id() const;
protected:
virtual inject_sync_event_t getInjectSyncEvent() const override

Loading…
Cancel
Save