... sync
authorVolker Birk <vb@pep.foundation>
Mon, 13 Aug 2018 16:34:36 +0200
branchsync
changeset 2843d3b9b81607d1
parent 2842 585f6f0e1a66
child 2844 6fce34991f7d
...
src/sync_impl.c
sync/gen_statemachine.ysl2
     1.1 --- a/src/sync_impl.c	Mon Aug 13 16:29:53 2018 +0200
     1.2 +++ b/src/sync_impl.c	Mon Aug 13 16:34:36 2018 +0200
     1.3 @@ -171,7 +171,7 @@
     1.4      if (status)
     1.5          goto the_end;
     1.6      
     1.7 -    session->messageToSend(session->sync_obj, m);
     1.8 +    status = session->messageToSend(session->sync_obj, m);
     1.9  
    1.10  the_end:
    1.11      free_message(m);
     2.1 --- a/sync/gen_statemachine.ysl2	Mon Aug 13 16:29:53 2018 +0200
     2.2 +++ b/sync/gen_statemachine.ysl2	Mon Aug 13 16:34:36 2018 +0200
     2.3 @@ -330,14 +330,14 @@
     2.4              if (!(session && fsm > None && message_type > None))
     2.5                  return PEP_ILLEGAL_VALUE;
     2.6              
     2.7 -            Sync_t *msg = new_«@name»_message(None, None);
     2.8 +            «@name»_t *msg = new_«@name»_message(None, None);
     2.9              if (!msg)
    2.10                  return PEP_OUT_OF_MEMORY;
    2.11  
    2.12              char *data = NULL;
    2.13              message *m = NULL;
    2.14  
    2.15 -            status = update_Sync_message(session, fsm, message_type, msg);
    2.16 +            status = update_«@name»_message(session, fsm, message_type, msg);
    2.17              if (status)
    2.18                  goto the_end;
    2.19  
    2.20 @@ -347,8 +347,8 @@
    2.21                  goto the_end;
    2.22  
    2.23              status = prepare_message(
    2.24 -                    session->sync_state.common.from,
    2.25 -                    session->sync_state.common.from,
    2.26 +                    session->«yml:lcase(@name)»_state.common.from,
    2.27 +                    session->«yml:lcase(@name)»_state.common.from,
    2.28                      data,
    2.29                      size,
    2.30                      &m
    2.31 @@ -356,7 +356,7 @@
    2.32              if (status)
    2.33                  goto the_end;
    2.34              
    2.35 -            status = session->messageToSend(session->sync_obj, m);
    2.36 +            status = session->messageToSend(session->«yml:lcase(@name)»_obj, m);
    2.37  
    2.38          the_end:
    2.39              free_message(m);
    2.40 @@ -419,7 +419,7 @@
    2.41      template "fsm", mode=event
    2.42      {
    2.43      ||
    2.44 -    case Sync_PR_«yml:lcase(@name)»: {
    2.45 +    case «../@name»_PR_«yml:lcase(@name)»: {
    2.46          switch (msg->choice.«yml:lcase(@name)».payload.present) {
    2.47      ||
    2.48      for "message"
    2.49 @@ -442,7 +442,7 @@
    2.50  
    2.51      template "fsm", mode=driver
    2.52      ||
    2.53 -    case Sync_PR_«yml:lcase(@name)»: {
    2.54 +    case «../@name»_PR_«yml:lcase(@name)»: {
    2.55          int state = session->«yml:lcase(../@name)»_state.«yml:lcase(@name)».state;
    2.56          next_state = fsm_«@name»(session, state, event);
    2.57          if (next_state > None) {
    2.58 @@ -660,7 +660,7 @@
    2.59          ||
    2.60          if "name(*[last()])!='transition'" {
    2.61              |
    2.62 -            |> KeySync_SERVICE_LOG("remaining in state", "«../@name»");
    2.63 +            |> «../../@name»_SERVICE_LOG("remaining in state", "«../@name»");
    2.64              |> break;
    2.65          }
    2.66          ||
    2.67 @@ -716,7 +716,7 @@
    2.68              return invalid_condition;
    2.69          }
    2.70          if (result) {
    2.71 -            KeySync_SERVICE_LOG("condition applies", "«@name»");
    2.72 +            «$fsm/@name»_SERVICE_LOG("condition applies", "«@name»");
    2.73          ||
    2.74              apply "transition|action|condition"
    2.75                  with "protocol", "$protocol", with "fsm", "$fsm";