Browse Source

merging

synchronous
Volker Birk 5 years ago
parent
commit
d5eb9eee7b
  1. 8
      callback_dispatcher.cc
  2. 6
      callback_dispatcher.hh

8
callback_dispatcher.cc

@ -2,7 +2,7 @@
#include <stdexcept> #include <stdexcept>
#include <cassert> #include <cassert>
pEp::CallbackDispatcher callback_dispatcher; pEp::CallbackDispatcher pEp::callback_dispatcher;
namespace pEp { namespace pEp {
bool CallbackDispatcher::once = true; bool CallbackDispatcher::once = true;
@ -62,11 +62,11 @@ namespace pEp {
void CallbackDispatcher::start_sync() void CallbackDispatcher::start_sync()
{ {
pEp::Adapter::startup<CallbackDispatcher>(CallbackDispatcher::messageToSend, pEp::Adapter::startup<CallbackDispatcher>(CallbackDispatcher::messageToSend,
CallbackDispatcher::notifyHandshake, this, CallbackDispatcher::notifyHandshake, &callback_dispatcher,
&CallbackDispatcher::on_startup, &CallbackDispatcher::on_startup,
&CallbackDispatcher::on_shutdown); &CallbackDispatcher::on_shutdown);
for (auto target : targets) for (auto target : callback_dispatcher.targets)
target.notifyHandshake(nullptr, nullptr, SYNC_NOTIFY_START); target.notifyHandshake(nullptr, nullptr, SYNC_NOTIFY_START);
} }
@ -74,7 +74,7 @@ namespace pEp {
{ {
pEp::Adapter::shutdown(); pEp::Adapter::shutdown();
for (auto target : targets) for (auto target : callback_dispatcher.targets)
target.notifyHandshake(nullptr, nullptr, SYNC_NOTIFY_STOP); target.notifyHandshake(nullptr, nullptr, SYNC_NOTIFY_STOP);
} }

6
callback_dispatcher.hh

@ -34,8 +34,8 @@ namespace pEp {
); );
void remove(::messageToSend_t messageToSend); void remove(::messageToSend_t messageToSend);
void start_sync(); static void start_sync();
void stop_sync(); static void stop_sync();
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,
@ -50,6 +50,6 @@ namespace pEp {
::pEp_identity *partner, ::sync_handshake_signal signal); ::pEp_identity *partner, ::sync_handshake_signal signal);
}; };
extern CallbackDispatcher callback_dispatcher;
}; };
extern pEp::CallbackDispatcher callback_dispatcher;

Loading…
Cancel
Save