ENGINE-128: merged in default ENGINE-128
authorKrista Grothoff <krista@pep-project.org>
Mon, 24 Oct 2016 21:32:38 +0200
branchENGINE-128
changeset 1332f4720efd0832
parent 1331 fe7e15cae527
parent 1330 0c55ede4d522
child 1333 5f474567e8eb
child 1334 85973d7d2859
ENGINE-128: merged in default
src/message_api.c
     1.1 --- a/src/message_api.c	Mon Oct 24 21:31:51 2016 +0200
     1.2 +++ b/src/message_api.c	Mon Oct 24 21:32:38 2016 +0200
     1.3 @@ -1693,7 +1693,7 @@
     1.4          decorate_message(msg, *rating, _keylist);
     1.5          if (imported_keys)
     1.6              remove_attached_keys(msg);
     1.7 -        if (*rating >= PEP_rating_reliable && session->retrieve_next_sync_msg) {
     1.8 +        if (*rating >= PEP_rating_reliable && session->inject_sync_msg) {
     1.9              status = receive_DeviceState_msg(session, msg, *rating, _keylist);
    1.10              if (status == PEP_MESSAGE_CONSUMED || 
    1.11                  status == PEP_MESSAGE_DISCARDED) {
     2.1 --- a/src/sync.c	Mon Oct 24 21:31:51 2016 +0200
     2.2 +++ b/src/sync.c	Mon Oct 24 21:32:38 2016 +0200
     2.3 @@ -108,20 +108,37 @@
     2.4  
     2.5      PEP_STATUS status = PEP_STATUS_OK;
     2.6  
     2.7 +    DeviceState_event event;
     2.8 +    bool need_partner = false;
     2.9 +
    2.10      switch (result) {
    2.11          case SYNC_HANDSHAKE_CANCEL:
    2.12 -            status = fsm_DeviceState_inject(session, Cancel, NULL, 0);
    2.13 +            event = Cancel;
    2.14              break;
    2.15          case SYNC_HANDSHAKE_ACCEPTED:
    2.16 -            status = fsm_DeviceState_inject(session, HandshakeAccepted, partner, 0);
    2.17 +        {
    2.18 +            event = HandshakeAccepted;
    2.19 +            need_partner = true;
    2.20              break;
    2.21 +        }
    2.22          case SYNC_HANDSHAKE_REJECTED:
    2.23 -            status = fsm_DeviceState_inject(session, HandshakeRejected, partner, 0);
    2.24 +        {
    2.25 +            event = HandshakeRejected;
    2.26 +            need_partner = true;
    2.27              break;
    2.28 +        }
    2.29          default:
    2.30              return PEP_ILLEGAL_VALUE;
    2.31      }
    2.32  
    2.33 +    pEp_identity *_partner = NULL;
    2.34 +    if(need_partner){
    2.35 +        _partner = identity_dup(partner);
    2.36 +        if (_partner == NULL)
    2.37 +            return PEP_OUT_OF_MEMORY;
    2.38 +    }
    2.39 +    status = inject_DeviceState_event(session, event, _partner, NULL);
    2.40 +
    2.41      return status;
    2.42  }
    2.43