Browse Source

add inject() for debugging

PYADPT-55
Volker Birk 9 years ago
parent
commit
1c4dc35614
  1. 11
      src/pEpmodule.cc
  2. 11
      src/sync_mixin.cc
  3. 3
      src/sync_mixin.hh

11
src/pEpmodule.cc

@ -198,9 +198,14 @@ BOOST_PYTHON_MODULE(pEp)
auto sync_mixin_class = class_<SyncMixIn, SyncMixIn_callback, boost::noncopyable>(
"SyncMixIn", "p≡p Sync MixIn")
.def("messageToSend", &SyncMixIn::messageToSend)
.def("showHandshake", &SyncMixIn::showHandshake)
.def("deliverHandshakeResult", &SyncMixIn::deliverHandshakeResult);
.def("messageToSend", &SyncMixIn::messageToSend, "overwrite this method")
.def("showHandshake", &SyncMixIn::showHandshake, "overwrite this method")
#ifndef NDEBUG
.def("_inject", &SyncMixIn::_inject,
"inject an event into the sync state machine (for debugging purposes only")
#endif
.def("deliverHandshakeResult", &SyncMixIn::deliverHandshakeResult,
"call to deliver the handshake result");
// init() and release()

11
src/sync_mixin.cc

@ -1,5 +1,8 @@
#include "sync_mixin.hh"
#include <pEp/sync.h>
#ifndef NDEBUG
#include <pEp/sync_fsm.h>
#endif
#include <assert.h>
namespace pEp {
@ -51,6 +54,14 @@ namespace pEp {
::deliverHandshakeResult(session, (sync_handshake_result) result);
}
#ifndef NDEBUG
virtual void _inject(int event, Identity *partner, object extra)
{
PEP_SESSION session = fsm_DeviceState_inject(session,
(DeviceState_event) event, partner->detach(), NULL);
}
#endif
void SyncMixIn_callback::_messageToSend(Message msg)
{
call_method< void >(_self, "messageToSend", msg);

3
src/sync_mixin.hh

@ -18,6 +18,9 @@ namespace pEp {
}
virtual void deliverHandshakeResult(int result);
#ifndef NDEBUG
virtual void _inject(int event, Identity *partner, object extra);
#endif
protected:
static PEP_STATUS _messageToSend(void *obj, message *msg);

Loading…
Cancel
Save