sync/cond_act_sync.yml2
branchsync
changeset 2902 5692b0768f9e
parent 2901 0d30b013e1b2
child 2905 1856a40d0cb5
     1.1 --- a/sync/cond_act_sync.yml2	Wed Aug 29 20:38:40 2018 +0200
     1.2 +++ b/sync/cond_act_sync.yml2	Wed Aug 29 21:40:59 2018 +0200
     1.3 @@ -18,6 +18,42 @@
     1.4      |> *result = _result > 0;
     1.5  }
     1.6  
     1.7 +condition weAreFirst
     1.8 +||
     1.9 +    TID_t *t1 = &session->sync_state.keysync.challenge;
    1.10 +    TID_t *t2 = &session->own_sync_state.challenge;
    1.11 +
    1.12 +    assert(t1 && t2);
    1.13 +
    1.14 +    if (!t2) {
    1.15 +        *result = false;
    1.16 +    }
    1.17 +    else {
    1.18 +        if (!t1)
    1.19 +            *result = true;
    1.20 +        else
    1.21 +            *result = _TID_greater(t1, t2);
    1.22 +    }
    1.23 +||
    1.24 +
    1.25 +condition weAreSecond
    1.26 +||
    1.27 +    TID_t *t1 = &session->sync_state.keysync.challenge;
    1.28 +    TID_t *t2 = &session->own_sync_state.challenge;
    1.29 +
    1.30 +    assert(t1 && t2);
    1.31 +
    1.32 +    if (!t1) {
    1.33 +        *result = false;
    1.34 +    }
    1.35 +    else {
    1.36 +        if (!t2)
    1.37 +            *result = true;
    1.38 +        else
    1.39 +            *result = !_TID_greater(t1, t2);
    1.40 +    }
    1.41 +||
    1.42 +
    1.43  condition partnerIsGrouped
    1.44  |> *result = session->sync_state.keysync.is_group;
    1.45