src/sync_send_actions.c
branchkeysync
changeset 1047 2a4a2ec1340b
parent 991 b230b6418b52
child 1058 1d34706c62d1
     1.1 --- a/src/sync_send_actions.c	Sat Aug 20 18:04:13 2016 +0200
     1.2 +++ b/src/sync_send_actions.c	Mon Aug 22 17:26:40 2016 +0200
     1.3 @@ -8,6 +8,7 @@
     1.4  #include "baseprotocol.h"
     1.5  #include "map_asn1.h"
     1.6  #include "../asn.1/DeviceGroup-Protocol.h"
     1.7 +#include "sync_impl.h"
     1.8  #include "../asn.1/Beacon.h"
     1.9  #include "../asn.1/HandshakeRequest.h"
    1.10  #include "../asn.1/GroupKeys.h"
    1.11 @@ -34,7 +35,6 @@
    1.12      Beacon_t *msg = NULL;
    1.13      char *payload = NULL;
    1.14      message *_message = NULL;
    1.15 -    pEp_identity *me = NULL;
    1.16  
    1.17      assert(session);
    1.18      assert(!partner);
    1.19 @@ -71,14 +71,6 @@
    1.20  
    1.21      msg->header.state = (long) state;
    1.22  
    1.23 -    me = new_identity(NULL, NULL, NULL, NULL);
    1.24 -    if (!me)
    1.25 -        goto enomem;
    1.26 -    status = myself(session, me);
    1.27 -    if (status != PEP_STATUS_OK)
    1.28 -        goto error;
    1.29 -    if (Identity_from_Struct(me, &msg->header.me) == NULL)
    1.30 -        goto enomem;
    1.31  
    1.32      if (asn_check_constraints(&asn_DEF_Beacon, msg, NULL, NULL)) {
    1.33          status = PEP_CONTRAINTS_VIOLATED;
    1.34 @@ -92,15 +84,7 @@
    1.35          goto error;
    1.36      }
    1.37  
    1.38 -    status = prepare_message(me, partner, payload, size, &_message);
    1.39 -    if (status != PEP_STATUS_OK)
    1.40 -        goto error;
    1.41 -    payload = NULL;
    1.42 -
    1.43 -    free_identity(me);
    1.44 -    me = NULL;
    1.45 -
    1.46 -    status = session->messageToSend(session->sync_obj, _message);
    1.47 +    status = multicast_self_msg(session, msg);
    1.48  
    1.49      ASN_STRUCT_FREE(asn_DEF_Beacon, msg);
    1.50      free_identity(partner);
    1.51 @@ -112,7 +96,6 @@
    1.52      ASN_STRUCT_FREE(asn_DEF_Beacon, msg);
    1.53      free(payload);
    1.54      free_message(_message);
    1.55 -    free_identity(me);
    1.56      free_identity(partner);
    1.57      return status;
    1.58  }
    1.59 @@ -176,7 +159,7 @@
    1.60  
    1.61      msg->header.state = (long) state;
    1.62  
    1.63 -    me = new_identity(NULL, NULL, NULL, NULL);
    1.64 +    me = new_identity(partner->address, NULL, PEP_OWN_USERID, NULL);
    1.65      if (!me)
    1.66          goto enomem;
    1.67      status = myself(session, me);
    1.68 @@ -282,7 +265,7 @@
    1.69  
    1.70      msg->header.state = (long) state;
    1.71  
    1.72 -    me = new_identity(NULL, NULL, NULL, NULL);
    1.73 +    me = new_identity(partner->address, NULL, PEP_OWN_USERID, NULL);
    1.74      if (!me)
    1.75          goto enomem;
    1.76      status = myself(session, me);