changing ownership keysync
authorVolker Birk <vb@pep.foundation>
Wed, 10 Aug 2016 14:12:19 +0200
branchkeysync
changeset 991b230b6418b52
parent 987 923fdc4de690
child 1001 42e0841b71f0
changing ownership
src/sync.h
src/sync_actions.c
src/sync_send_actions.c
sync/gen_actions_skeleton.ysl2
     1.1 --- a/src/sync.h	Tue Aug 09 00:28:53 2016 +0200
     1.2 +++ b/src/sync.h	Wed Aug 10 14:12:19 2016 +0200
     1.3 @@ -20,8 +20,11 @@
     1.4  //
     1.5  //  return value:
     1.6  //      PEP_STATUS_OK or any other value on error
     1.7 +//
     1.8 +//  caveat:
     1.9 +//      the ownership of msg goes to the callee
    1.10  
    1.11 -typedef PEP_STATUS (*messageToSend_t)(void *obj, const message *msg);
    1.12 +typedef PEP_STATUS (*messageToSend_t)(void *obj, message *msg);
    1.13  
    1.14  
    1.15  typedef enum _sync_handshake_result {
    1.16 @@ -39,11 +42,14 @@
    1.17  //
    1.18  //  return value:
    1.19  //      PEP_STATUS_OK or any other value on error
    1.20 +//
    1.21 +//  caveat:
    1.22 +//      ownership of self and partner go to the callee
    1.23  
    1.24  typedef PEP_STATUS (*showHandshake_t)(
    1.25          void *obj,
    1.26 -        const pEp_identity *self,
    1.27 -        const pEp_identity *partner
    1.28 +        pEp_identity *self,
    1.29 +        pEp_identity *partner
    1.30      );
    1.31  
    1.32  
     2.1 --- a/src/sync_actions.c	Tue Aug 09 00:28:53 2016 +0200
     2.2 +++ b/src/sync_actions.c	Wed Aug 10 14:12:19 2016 +0200
     2.3 @@ -136,8 +136,6 @@
     2.4      if (status != PEP_STATUS_OK)
     2.5          goto error;
     2.6  
     2.7 -    free_identity(me);
     2.8 -    free_identity(partner);
     2.9      return status;
    2.10  
    2.11  error:
     3.1 --- a/src/sync_send_actions.c	Tue Aug 09 00:28:53 2016 +0200
     3.2 +++ b/src/sync_send_actions.c	Wed Aug 10 14:12:19 2016 +0200
     3.3 @@ -102,7 +102,6 @@
     3.4  
     3.5      status = session->messageToSend(session->sync_obj, _message);
     3.6  
     3.7 -    free_message(_message);
     3.8      ASN_STRUCT_FREE(asn_DEF_Beacon, msg);
     3.9      free_identity(partner);
    3.10      return status;
    3.11 @@ -208,7 +207,6 @@
    3.12  
    3.13      status = session->messageToSend(session->sync_obj, _message);
    3.14  
    3.15 -    free_message(_message);
    3.16      ASN_STRUCT_FREE(asn_DEF_HandshakeRequest, msg);
    3.17      free_identity(partner);
    3.18      return status;
    3.19 @@ -321,7 +319,6 @@
    3.20  
    3.21      status = session->messageToSend(session->sync_obj, _message);
    3.22  
    3.23 -    free_message(_message);
    3.24      ASN_STRUCT_FREE(asn_DEF_GroupKeys, msg);
    3.25      free_identity(partner);
    3.26      free_identity_list(kl);
     4.1 --- a/sync/gen_actions_skeleton.ysl2	Tue Aug 09 00:28:53 2016 +0200
     4.2 +++ b/sync/gen_actions_skeleton.ysl2	Wed Aug 10 14:12:19 2016 +0200
     4.3 @@ -234,7 +234,6 @@
     4.4  
     4.5              status = session->messageToSend(session->«$filename»_obj, _message);
     4.6  
     4.7 -            free_message(_message);
     4.8              ASN_STRUCT_FREE(asn_DEF_«$name», msg);
     4.9              free_identity(partner);
    4.10              `` if "$name='GroupKeys'" |> free_identity_list(kl);