COM server adapter including sync sync
authorVolker Birk <vb@pep.foundation>
Tue, 16 Oct 2018 01:24:16 +0200
branchsync
changeset 29643d9e57b6561
parent 295 f55ec2fd694f
child 297 a48f0545e221
COM server adapter including sync
CpEpEngine.cpp
CpEpEngine.h
     1.1 --- a/CpEpEngine.cpp	Mon Oct 15 22:15:24 2018 +0200
     1.2 +++ b/CpEpEngine.cpp	Tue Oct 16 01:24:16 2018 +0200
     1.3 @@ -21,6 +21,8 @@
     1.4  std::list< IpEpEngineCallbacks * > CpEpEngine::all_callbacks;
     1.5  std::mutex CpEpEngine::callbacks_mutex;
     1.6  
     1.7 +atomic< int > CpEpEngine::count = 0;
     1.8 +
     1.9  STDMETHODIMP CpEpEngine::InterfaceSupportsErrorInfo(REFIID riid)
    1.10  {
    1.11      static const IID* const arr[] =
     2.1 --- a/CpEpEngine.h	Mon Oct 15 22:15:24 2018 +0200
     2.2 +++ b/CpEpEngine.h	Tue Oct 16 01:24:16 2018 +0200
     2.3 @@ -38,13 +38,18 @@
     2.4      {
     2.5          // See FinalConstruct() below for most initialization work, and an
     2.6          // explanation why it had to be moved there...
     2.7 +        ++count;
     2.8      }
     2.9  
    2.10      ~CpEpEngine()
    2.11      {
    2.12 -        StopKeyserverLookup();
    2.13 -        ::log_event(session(), "Shutdown", "pEp COM Adapter", NULL, NULL);
    2.14 -        session(pEp::Adapter::release);
    2.15 +        --count;
    2.16 +        if (!count) {
    2.17 +            StopKeyserverLookup();
    2.18 +            ::log_event(session(), "Shutdown", "pEp COM Adapter", NULL, NULL);
    2.19 +            session(pEp::Adapter::release);
    2.20 +            shutdown();
    2.21 +        }
    2.22      }
    2.23  
    2.24      DECLARE_REGISTRY_RESOURCEID(IDR_PEPENGINE)
    2.25 @@ -80,6 +85,7 @@
    2.26  
    2.27          ::register_examine_function(session(), CpEpEngine::examine_identity, (void *)this);
    2.28          ::log_event(session(), "Startup", "pEp COM Adapter", NULL, NULL);
    2.29 +        startup(messageToSend, notifyHandshake);
    2.30          return S_OK;
    2.31      }
    2.32  
    2.33 @@ -119,6 +125,8 @@
    2.34      static std::list< IpEpEngineCallbacks * > all_callbacks;
    2.35      static std::mutex callbacks_mutex;
    2.36  
    2.37 +    static atomic< int > count;
    2.38 +
    2.39  public:
    2.40      // runtime config of the adapter
    2.41