make the baby cry sync
authorVolker Birk <vb@pep.foundation>
Thu, 23 Aug 2018 11:43:22 +0200
branchsync
changeset 2883a372b8f58aa1
parent 2882 76f789a19606
child 2884 2ed5aba15296
make the baby cry
src/pEpEngine.c
test/src/engine_tests/SyncTests.cc
     1.1 --- a/src/pEpEngine.c	Thu Aug 23 10:40:58 2018 +0200
     1.2 +++ b/src/pEpEngine.c	Thu Aug 23 11:43:22 2018 +0200
     1.3 @@ -3033,8 +3033,12 @@
     1.4      if (!(session && ctext && csize && ptext && psize && keylist))
     1.5          return PEP_ILLEGAL_VALUE;
     1.6  
     1.7 -    return session->cryptotech[PEP_crypt_OpenPGP].decrypt_and_verify(
     1.8 +    PEP_STATUS status = session->cryptotech[PEP_crypt_OpenPGP].decrypt_and_verify(
     1.9              session, ctext, csize, dsigtext, dsigsize, ptext, psize, keylist);
    1.10 +    if (status == PEP_DECRYPT_NO_KEY)
    1.11 +        signal_Sync_event(session, Sync_PR_keysync, CannotDecrypt);
    1.12 +
    1.13 +    return status;
    1.14  }
    1.15  
    1.16  DYNAMIC_API PEP_STATUS encrypt_and_sign(
     2.1 --- a/test/src/engine_tests/SyncTests.cc	Thu Aug 23 10:40:58 2018 +0200
     2.2 +++ b/test/src/engine_tests/SyncTests.cc	Thu Aug 23 11:43:22 2018 +0200
     2.3 @@ -45,15 +45,18 @@
     2.4      static Sync_event_t *retrieve_next_sync_event(void *management)
     2.5      {
     2.6          auto adapter = static_cast< Sync_Adapter *>(management);
     2.7 +
     2.8          while (adapter->q.empty()) {
     2.9              sleep(1);
    2.10          }
    2.11 -        Sync_event_t *result = adapter->q.pop_front();
    2.12 -        if (result)
    2.13 +
    2.14 +        Sync_event_t *ev = adapter->q.pop_front();
    2.15 +        if (ev)
    2.16              cout << "retrieving sync event\n";
    2.17          else
    2.18              cout << "retrieving shutdown\n";
    2.19 -        return result;
    2.20 +
    2.21 +        return ev;
    2.22      }
    2.23  
    2.24      static PEP_STATUS messageToSend(void *obj, struct _message *msg)