diff --git a/Adapter.hxx b/Adapter.hxx index 903be07..3fb539b 100644 --- a/Adapter.hxx +++ b/Adapter.hxx @@ -17,13 +17,13 @@ namespace pEp { template< class T > void sync_thread(T *obj, function< void(T *) > _startup, function< void(T *) > _shutdown) { + if (obj && _startup) + _startup(obj); + PEP_STATUS status = register_sync_callbacks(session(), nullptr, _notifyHandshake, _retrieve_next_sync_event); throw_status(status); - if (obj && _startup) - _startup(obj); - do_sync_protocol(session(), (void *)obj); unregister_sync_callbacks(session());