merge "default" into my branch… ENGINE-199
authorRoker <roker@pep-project.org>
Fri, 21 Apr 2017 21:39:42 +0200
branchENGINE-199
changeset 173618b244fa4710
parent 1735 486bfe88057f
parent 1733 4bfa4eb35ca3
child 1753 01faac16cec6
merge "default" into my branch…
     1.1 --- a/src/sync.h	Fri Apr 21 21:39:28 2017 +0200
     1.2 +++ b/src/sync.h	Fri Apr 21 21:39:42 2017 +0200
     1.3 @@ -309,11 +309,12 @@
     1.4  //  parameters:
     1.5  //      management (in)     application defined
     1.6  //      timeout (in,out)    do not wait longer than timeout for message
     1.7 +//                          timeout == NULL or *timeout == 0 is blocking
     1.8  //
     1.9  //  return value:
    1.10 -//      next message or :
    1.11 -//      NULL and timeout == 0 for termination
    1.12 -//      NULL and timeout != 0 for timeout occurence
    1.13 +//      next message, then timeout[out] == remaining time
    1.14 +//      NULL and timeout[out] != 0 for timeout occurence
    1.15 +//      NULL and timeout[out] == 0 for termination
    1.16  
    1.17  typedef void *(*retrieve_next_sync_msg_t)(void *management, time_t *timeout);
    1.18  
     2.1 --- a/sync/gen_statemachine.ysl2	Fri Apr 21 21:39:28 2017 +0200
     2.2 +++ b/sync/gen_statemachine.ysl2	Fri Apr 21 21:39:42 2017 +0200
     2.3 @@ -231,7 +231,6 @@
     2.4          ||
     2.5  
     2.6          ||
     2.7 -            *timeout = «@timeout»;
     2.8              switch (event) {
     2.9          ||
    2.10  
    2.11 @@ -239,6 +238,7 @@
    2.12          ||
    2.13                  case Init: 
    2.14                      DEBUG_LOG("FSM event", "«../@filename»_fsm.c, state=«@name»", "event=Init") 
    2.15 +                    *timeout = «@timeout»;
    2.16                      break;
    2.17          ||
    2.18  
    2.19 @@ -300,13 +300,16 @@
    2.20          case «@name»:
    2.21          {
    2.22              DEBUG_LOG("FSM event", "«../../@filename»_fsm.c, state=«../@name»", "event=«@name»")
    2.23 +        `` if "@name='Init'" |> *timeout = «../@timeout»;
    2.24          ||
    2.25 +
    2.26          if "count(parm) > 1" {
    2.27              // TODO get ride of void *extra, pass per-event struct incl all params.
    2.28              const "extrapEpType" call "pEp_type" with "type","name(parm[2]/*[1])"; 
    2.29              const "extraArgName","name(parm[2]/*[2])"; 
    2.30              |> «$extrapEpType» «$extraArgName» = («$extrapEpType»)extra;
    2.31          }
    2.32 +
    2.33          ||
    2.34          `` apply "action|transition|condition";
    2.35          `` if "name(*[position()=last()]) != 'transition'" |> break;
     3.1 --- a/sync/generated/sync_fsm.c	Fri Apr 21 21:39:28 2017 +0200
     3.2 +++ b/sync/generated/sync_fsm.c	Fri Apr 21 21:39:42 2017 +0200
     3.3 @@ -56,11 +56,11 @@
     3.4          case InitState:
     3.5          {
     3.6              DEBUG_LOG("Entering FSM state", "sync_fsm.c", "state=InitState")
     3.7 -            *timeout = 0;
     3.8              switch (event) {
     3.9                  case Init:
    3.10                  {
    3.11                      DEBUG_LOG("FSM event", "sync_fsm.c, state=InitState", "event=Init")
    3.12 +                    *timeout = 0;
    3.13                      {
    3.14                          int cond_result = deviceGrouped(session);
    3.15                          #ifndef NDEBUG
    3.16 @@ -86,10 +86,10 @@
    3.17          case Sole:
    3.18          {
    3.19              DEBUG_LOG("Entering FSM state", "sync_fsm.c", "state=Sole")
    3.20 -            *timeout = 0;
    3.21              switch (event) {
    3.22                  case Init: 
    3.23                      DEBUG_LOG("FSM event", "sync_fsm.c, state=Sole", "event=Init") 
    3.24 +                    *timeout = 0;
    3.25                      break;
    3.26                  case KeyGen:
    3.27                  {
    3.28 @@ -158,10 +158,10 @@
    3.29              assert(session->sync_state_payload);
    3.30              if(!session->sync_state_payload) return (DeviceState_state) invalid_state;
    3.31              Identity expected = ((SoleBeaconed_state_payload_t*)session->sync_state_payload)->expected;
    3.32 -            *timeout = 600;
    3.33              switch (event) {
    3.34                  case Init: 
    3.35                      DEBUG_LOG("FSM event", "sync_fsm.c, state=SoleBeaconed", "event=Init") 
    3.36 +                    *timeout = 600;
    3.37                      break;
    3.38                  case KeyGen:
    3.39                  {
    3.40 @@ -277,11 +277,11 @@
    3.41              assert(session->sync_state_payload);
    3.42              if(!session->sync_state_payload) return (DeviceState_state) invalid_state;
    3.43              Identity expected = ((HandshakingSole_state_payload_t*)session->sync_state_payload)->expected;
    3.44 -            *timeout = 600;
    3.45              switch (event) {
    3.46                  case Init:
    3.47                  {
    3.48                      DEBUG_LOG("FSM event", "sync_fsm.c, state=HandshakingSole", "event=Init")
    3.49 +                    *timeout = 600;
    3.50                      {
    3.51                          int cond_result = keyElectionWon(session, expected);
    3.52                          #ifndef NDEBUG
    3.53 @@ -502,10 +502,10 @@
    3.54              assert(session->sync_state_payload);
    3.55              if(!session->sync_state_payload) return (DeviceState_state) invalid_state;
    3.56              Identity expected = ((WaitForGroupKeysSole_state_payload_t*)session->sync_state_payload)->expected;
    3.57 -            *timeout = 600;
    3.58              switch (event) {
    3.59                  case Init: 
    3.60                      DEBUG_LOG("FSM event", "sync_fsm.c, state=WaitForGroupKeysSole", "event=Init") 
    3.61 +                    *timeout = 600;
    3.62                      break;
    3.63                  case GroupKeys:
    3.64                  {
    3.65 @@ -585,10 +585,10 @@
    3.66              if(!session->sync_state_payload) return (DeviceState_state) invalid_state;
    3.67              Identity expected = ((WaitForAcceptSole_state_payload_t*)session->sync_state_payload)->expected;
    3.68              group_keys_extra_t* groupkeys = ((WaitForAcceptSole_state_payload_t*)session->sync_state_payload)->groupkeys;
    3.69 -            *timeout = 600;
    3.70              switch (event) {
    3.71                  case Init: 
    3.72                      DEBUG_LOG("FSM event", "sync_fsm.c, state=WaitForAcceptSole", "event=Init") 
    3.73 +                    *timeout = 600;
    3.74                      break;
    3.75                  case HandshakeRejected:
    3.76                  {
    3.77 @@ -708,10 +708,10 @@
    3.78          case Grouped:
    3.79          {
    3.80              DEBUG_LOG("Entering FSM state", "sync_fsm.c", "state=Grouped")
    3.81 -            *timeout = 0;
    3.82              switch (event) {
    3.83                  case Init: 
    3.84                      DEBUG_LOG("FSM event", "sync_fsm.c, state=Grouped", "event=Init") 
    3.85 +                    *timeout = 0;
    3.86                      break;
    3.87                  case KeyGen:
    3.88                  {
    3.89 @@ -809,10 +809,10 @@
    3.90              assert(session->sync_state_payload);
    3.91              if(!session->sync_state_payload) return (DeviceState_state) invalid_state;
    3.92              Identity expected = ((GroupedBeaconed_state_payload_t*)session->sync_state_payload)->expected;
    3.93 -            *timeout = 600;
    3.94              switch (event) {
    3.95                  case Init: 
    3.96                      DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupedBeaconed", "event=Init") 
    3.97 +                    *timeout = 600;
    3.98                      break;
    3.99                  case KeyGen:
   3.100                  {
   3.101 @@ -945,11 +945,11 @@
   3.102              assert(session->sync_state_payload);
   3.103              if(!session->sync_state_payload) return (DeviceState_state) invalid_state;
   3.104              Identity expected = ((HandshakingGrouped_state_payload_t*)session->sync_state_payload)->expected;
   3.105 -            *timeout = 600;
   3.106              switch (event) {
   3.107                  case Init:
   3.108                  {
   3.109                      DEBUG_LOG("FSM event", "sync_fsm.c, state=HandshakingGrouped", "event=Init")
   3.110 +                    *timeout = 600;
   3.111                      {
   3.112                          int cond_result = keyElectionWon(session, expected);
   3.113                          #ifndef NDEBUG
   3.114 @@ -1169,10 +1169,10 @@
   3.115              assert(session->sync_state_payload);
   3.116              if(!session->sync_state_payload) return (DeviceState_state) invalid_state;
   3.117              Identity expected = ((WaitForGroupKeysGrouped_state_payload_t*)session->sync_state_payload)->expected;
   3.118 -            *timeout = 600;
   3.119              switch (event) {
   3.120                  case Init: 
   3.121                      DEBUG_LOG("FSM event", "sync_fsm.c, state=WaitForGroupKeysGrouped", "event=Init") 
   3.122 +                    *timeout = 600;
   3.123                      break;
   3.124                  case GroupKeys:
   3.125                  {
   3.126 @@ -1276,10 +1276,10 @@
   3.127              if(!session->sync_state_payload) return (DeviceState_state) invalid_state;
   3.128              Identity expected = ((WaitForAcceptGrouped_state_payload_t*)session->sync_state_payload)->expected;
   3.129              group_keys_extra_t* groupkeys = ((WaitForAcceptGrouped_state_payload_t*)session->sync_state_payload)->groupkeys;
   3.130 -            *timeout = 600;
   3.131              switch (event) {
   3.132                  case Init: 
   3.133                      DEBUG_LOG("FSM event", "sync_fsm.c, state=WaitForAcceptGrouped", "event=Init") 
   3.134 +                    *timeout = 600;
   3.135                      break;
   3.136                  case HandshakeRejected:
   3.137                  {