Browse Source

dispatching

COM-121
Volker Birk 2 years ago
parent
commit
a7a15112ec
3 changed files with 15 additions and 12 deletions
  1. +7
    -1
      CpEpEngine.cpp
  2. +1
    -1
      LocalJSONAdapter.h
  3. +7
    -10
      pEpCOMServerAdapter.cpp

+ 7
- 1
CpEpEngine.cpp View File

@ -5,6 +5,7 @@
#include <mutex>
#include "GateKeeper.h"
#include "..\libpEpAdapter\Adapter.hh"
#include "LocalJSONAdapter.h"
#include "pEp\status_to_string.h"
using namespace std;
@ -22,6 +23,8 @@ CpEpEngine::callback_container CpEpEngine::sync_callbacks;
std::mutex CpEpEngine::init_mutex;
atomic< int > CpEpEngine::count = 0;
extern LocalJSONAdapter* ljs;
STDMETHODIMP CpEpEngine::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* const arr[] =
@ -1031,6 +1034,9 @@ PEP_STATUS CpEpEngine::messageToSend(message *msg)
sync_callbacks.compact();
if (ljs)
ljs->messageToSend(msg);
return PEP_STATUS_OK;
}
@ -1836,7 +1842,7 @@ STDMETHODIMP CpEpEngine::Startup()
{
try
{
startup<CpEpEngine>(messageToSend, notifyHandshake, this, &CpEpEngine::Startup_sync, &CpEpEngine::Shutdown_sync);
pEp::Adapter::startup<CpEpEngine>(CpEpEngine::messageToSend, CpEpEngine::notifyHandshake, this, &CpEpEngine::Startup_sync, &CpEpEngine::Shutdown_sync);
}
catch (bad_alloc&) {
return E_OUTOFMEMORY;


+ 1
- 1
LocalJSONAdapter.h View File

@ -1,7 +1,7 @@
#pragma once
#include "stdafx.h"
#include "json-adapter.hh"
#include <pEp/Adapter.hh>
#include "..\libpEpAdapter\Adapter.hh""
class LocalJSONAdapter :
public JsonAdapter


+ 7
- 10
pEpCOMServerAdapter.cpp View File

@ -19,8 +19,8 @@ void CpEpCOMServerAdapterModule::gatekeeper(CpEpCOMServerAdapterModule * self)
}
CpEpCOMServerAdapterModule _AtlModule;
LocalJSONAdapter* ljs = nullptr;
//
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
LPTSTR lpCmdLine, int nShowCmd)
{
@ -30,19 +30,16 @@ extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/
PEP_SESSION first_session;
PEP_STATUS status = ::init(&first_session, NULL, NULL);
LocalJSONAdapter* ljs = nullptr;
SessionRegistry* sr = nullptr;
if (!boost::algorithm::iequals(lpCmdLine, "/regserver"))
ljs= &LocalJSONAdapter::createInstance();
if (ljs)
ljs->startup();
if (!boost::algorithm::iequals(lpCmdLine, "/regserver")) {
ljs = &LocalJSONAdapter::createInstance();
ljs->startup(pEp::Adapter::_messageToSend);
}
auto rv = _AtlModule.WinMain(nShowCmd);
if (ljs)
if (ljs) {
ljs->shutdown_now();
}
::release(first_session);
return rv;


Loading…
Cancel
Save