CpEpEngine.h
branchsync
changeset 296 43d9e57b6561
parent 295 f55ec2fd694f
child 297 a48f0545e221
     1.1 --- a/CpEpEngine.h	Mon Oct 15 22:15:24 2018 +0200
     1.2 +++ b/CpEpEngine.h	Tue Oct 16 01:24:16 2018 +0200
     1.3 @@ -38,13 +38,18 @@
     1.4      {
     1.5          // See FinalConstruct() below for most initialization work, and an
     1.6          // explanation why it had to be moved there...
     1.7 +        ++count;
     1.8      }
     1.9  
    1.10      ~CpEpEngine()
    1.11      {
    1.12 -        StopKeyserverLookup();
    1.13 -        ::log_event(session(), "Shutdown", "pEp COM Adapter", NULL, NULL);
    1.14 -        session(pEp::Adapter::release);
    1.15 +        --count;
    1.16 +        if (!count) {
    1.17 +            StopKeyserverLookup();
    1.18 +            ::log_event(session(), "Shutdown", "pEp COM Adapter", NULL, NULL);
    1.19 +            session(pEp::Adapter::release);
    1.20 +            shutdown();
    1.21 +        }
    1.22      }
    1.23  
    1.24      DECLARE_REGISTRY_RESOURCEID(IDR_PEPENGINE)
    1.25 @@ -80,6 +85,7 @@
    1.26  
    1.27          ::register_examine_function(session(), CpEpEngine::examine_identity, (void *)this);
    1.28          ::log_event(session(), "Startup", "pEp COM Adapter", NULL, NULL);
    1.29 +        startup(messageToSend, notifyHandshake);
    1.30          return S_OK;
    1.31      }
    1.32  
    1.33 @@ -119,6 +125,8 @@
    1.34      static std::list< IpEpEngineCallbacks * > all_callbacks;
    1.35      static std::mutex callbacks_mutex;
    1.36  
    1.37 +    static atomic< int > count;
    1.38 +
    1.39  public:
    1.40      // runtime config of the adapter
    1.41