first new one has to send keys sync
authorVolker Birk <vb@pep-project.org>
Sun, 14 Apr 2019 15:15:07 +0200
branchsync
changeset 3520cff778fa5330
parent 3519 2b360f5f1d30
child 3521 84b54c7ef0b5
first new one has to send keys
sync/gen_statemachine.ysl2
sync/sync.fsm
     1.1 --- a/sync/gen_statemachine.ysl2	Sun Apr 14 14:47:13 2019 +0200
     1.2 +++ b/sync/gen_statemachine.ysl2	Sun Apr 14 15:15:07 2019 +0200
     1.3 @@ -1097,7 +1097,7 @@
     1.4      }
     1.5  
     1.6      template "else" {
     1.7 -        if "not(name(preceding-sibling::*[last()]) = 'condition')"
     1.8 +        if "not(name(preceding-sibling::*[1]) = 'condition')"
     1.9              error "else without if";
    1.10  
    1.11          | else {
     2.1 --- a/sync/sync.fsm	Sun Apr 14 14:47:13 2019 +0200
     2.2 +++ b/sync/sync.fsm	Sun Apr 14 15:15:07 2019 +0200
     2.3 @@ -219,6 +219,8 @@
     2.4              }
     2.5  
     2.6              on GroupKeysAndClose if sameTransaction {
     2.7 +                do saveGroupKeys;
     2.8 +
     2.9                  if keyElectionWon
    2.10                      do ownKeysAreGroupKeys;
    2.11                  else
    2.12 @@ -234,6 +236,8 @@
    2.13              }
    2.14  
    2.15              on GroupKeys {
    2.16 +                do saveGroupKeys;
    2.17 +
    2.18                  if keyElectionWon
    2.19                      do ownKeysAreGroupKeys;
    2.20                  else
    2.21 @@ -328,22 +332,19 @@
    2.22  
    2.23              on Accept {
    2.24                  do trustThisKey;
    2.25 -                go OwnGroup;
    2.26 +                go JoinGroup;
    2.27              }
    2.28          }
    2.29  
    2.30          state JoinGroup {
    2.31 +            on Init {
    2.32 +                // first send own keys
    2.33 +                send GroupKeys;
    2.34 +            }
    2.35 +
    2.36              on GroupKeysAndClose {
    2.37 -                send GroupKeys; // first send own keys
    2.38                  do saveGroupKeys; // then store new group keys
    2.39 -                go Grouped;
    2.40 -            }
    2.41 -        }
    2.42 -
    2.43 -        state OwnGroup {
    2.44 -            on GroupKeys {
    2.45 -                send GroupKeys; // first send own keys
    2.46 -                do saveGroupKeys; // then store new group keys
    2.47 +                do receivedKeysAreGroupKeys;
    2.48                  go Grouped;
    2.49              }
    2.50          }