send beacon sync
authorVolker Birk <vb@pep.foundation>
Wed, 22 Aug 2018 21:44:48 +0200
branchsync
changeset 28758e3169c2952a
parent 2874 45531079b073
child 2876 6ad08f60ae1b
send beacon
sync/gen_codec.ysl2
sync/gen_statemachine.ysl2
test/src/engine_tests/SyncTests.cc
     1.1 --- a/sync/gen_codec.ysl2	Wed Aug 22 20:51:23 2018 +0200
     1.2 +++ b/sync/gen_codec.ysl2	Wed Aug 22 21:44:48 2018 +0200
     1.3 @@ -117,10 +117,12 @@
     1.4                  return PEP_ILLEGAL_VALUE;
     1.5  
     1.6              *msg = NULL;
     1.7 -            uper_decode_complete(NULL, &asn_DEF_«@name», (void **) &msg, data, size);
     1.8 -            if (!msg)
     1.9 +            «@name»_t *_msg = NULL;
    1.10 +            uper_decode_complete(NULL, &asn_DEF_«@name», (void **) &_msg, data, size);
    1.11 +            if (!_msg)
    1.12                  return PEP_«yml:ucase(@name)»_ILLEGAL_MESSAGE;
    1.13  
    1.14 +            *msg = _msg;
    1.15              return PEP_STATUS_OK;
    1.16          }
    1.17  
     2.1 --- a/sync/gen_statemachine.ysl2	Wed Aug 22 20:51:23 2018 +0200
     2.2 +++ b/sync/gen_statemachine.ysl2	Wed Aug 22 21:44:48 2018 +0200
     2.3 @@ -350,7 +350,7 @@
     2.4                      // these messages are being broadcasted
     2.5                      `` for "fsm/message[@type='broadcast']" |>> case «../@name»__payload_PR_«yml:lcase(@name)»:
     2.6                          status = _own_identities_retrieve(session, &channels, PEP_idf_not_for_«yml:lcase(@name)»);
     2.7 -                        if (!status)
     2.8 +                        if (status)
     2.9                              goto the_end;
    2.10  
    2.11                          if (!(channels && channels->ident)) {
    2.12 @@ -407,9 +407,9 @@
    2.13                          );
    2.14                      if (status)
    2.15                          goto the_end;
    2.16 -                    
    2.17 +                    data = NULL;
    2.18 +
    2.19                      status = session->messageToSend(session->«yml:lcase(@name)»_obj, m);
    2.20 -                    free_message(m);
    2.21                      m = NULL;
    2.22                  }
    2.23  
     3.1 --- a/test/src/engine_tests/SyncTests.cc	Wed Aug 22 20:51:23 2018 +0200
     3.2 +++ b/test/src/engine_tests/SyncTests.cc	Wed Aug 22 21:44:48 2018 +0200
     3.3 @@ -89,9 +89,7 @@
     3.4      Sync_Adapter adapter;
     3.5      PEP_SESSION sync = NULL;
     3.6      thread *sync_thread;
     3.7 -
     3.8 -    PEP_STATUS status = init(&sync, Sync_Adapter::messageToSend);
     3.9 -    TEST_ASSERT(status == PEP_STATUS_OK);
    3.10 +    PEP_STATUS status = PEP_STATUS_OK;
    3.11  
    3.12      pEp_identity *self = new_identity("alice@synctests.pep", nullptr, "23", "Alice Miller");
    3.13      assert(self);
    3.14 @@ -102,6 +100,9 @@
    3.15      cout << "fpr: " << self->fpr << "\n";
    3.16      free_identity(self);
    3.17  
    3.18 +    status = init(&sync, Sync_Adapter::messageToSend);
    3.19 +    TEST_ASSERT(status == PEP_STATUS_OK);
    3.20 +
    3.21      status = register_sync_callbacks(
    3.22              sync,
    3.23              &adapter.q,