sync/gen_statemachine.ysl2
branchkeysync
changeset 1157 7d383681ef2f
parent 1152 fde1a69448d2
child 1162 f8db5c47b7f3
     1.1 --- a/sync/gen_statemachine.ysl2	Sun Sep 11 22:32:22 2016 +0200
     1.2 +++ b/sync/gen_statemachine.ysl2	Sun Sep 11 22:40:59 2016 +0200
     1.3 @@ -141,18 +141,22 @@
     1.4  
     1.5              while(true)
     1.6              {
     1.7 +                Identity _partner = partner ? identity_dup(partner) : NULL;
     1.8 +
     1.9                  «@name»_state new_state = fsm_«@name»(session,
    1.10 -                    session->«@filename»_state, event, partner, extra);
    1.11 +                    session->«@filename»_state, event, _partner, extra);
    1.12 +
    1.13                  if (new_state == «@name»_state_invalid_out_of_memory)
    1.14                      return PEP_OUT_OF_MEMORY;
    1.15 +
    1.16                  if (new_state < 0)
    1.17                      return PEP_SYNC_STATEMACHINE_ERROR - new_state;
    1.18                  
    1.19 -                if (new_state == session->sync_state)
    1.20 +                if (new_state == session->«@filename»_state)
    1.21                      break;
    1.22 -                else
    1.23 -                    event = Init;
    1.24  
    1.25 +                event = Init;
    1.26 +                extra = NULL;
    1.27                  session->«@filename»_state = new_state;
    1.28              } 
    1.29  
    1.30 @@ -193,7 +197,7 @@
    1.31      ||
    1.32      case «@name»:
    1.33          switch (event) {
    1.34 -        ``if "not(event[@name='Init'])" |>> case Init: break;
    1.35 +        `` if "not(event[@name='Init'])" |>> case Init: break;
    1.36          `` apply "event", 2
    1.37              default:
    1.38                  return («../@name»_state) invalid_event;