ignore own beacons sync
authorVolker Birk <vb@pep-project.org>
Thu, 28 Mar 2019 13:44:04 +0100
branchsync
changeset 3413206593c06991
parent 3412 f99244015bda
child 3419 4d74b3f06a4a
ignore own beacons
src/message_api.c
sync/sync.fsm
     1.1 --- a/src/message_api.c	Thu Mar 28 06:55:06 2019 +0100
     1.2 +++ b/src/message_api.c	Thu Mar 28 13:44:04 2019 +0100
     1.3 @@ -3825,6 +3825,12 @@
     1.4      return status;
     1.5  }
     1.6  
     1.7 +static bool _own_sync_beacon(PEP_STATUS status, const char *sync_fpr,
     1.8 +        const char *from_fpr) {
     1.9 +    return status == PEP_UNENCRYPTED && sync_fpr && sync_fpr[0] &&
    1.10 +        from_fpr && from_fpr[0] && strcmp(sync_fpr, from_fpr) == 0;
    1.11 +}
    1.12 +
    1.13  DYNAMIC_API PEP_STATUS decrypt_message(
    1.14          PEP_SESSION session,
    1.15          message *src,
    1.16 @@ -3857,8 +3863,10 @@
    1.17          const char *data;
    1.18          char *sync_fpr = NULL;
    1.19          PEP_STATUS tmpstatus = base_extract_message(session, msg, &size, &data, &sync_fpr);
    1.20 -        if (!tmpstatus && size && data)
    1.21 -            signal_Sync_message(session, *rating, data, size, msg->from, sync_fpr);
    1.22 +        if (!tmpstatus && size && data) {
    1.23 +            if (!_own_sync_beacon(status, sync_fpr, msg->from->fpr))
    1.24 +                signal_Sync_message(session, *rating, data, size, msg->from, sync_fpr);
    1.25 +        }
    1.26          free(sync_fpr);
    1.27      }
    1.28  
     2.1 --- a/sync/sync.fsm	Thu Mar 28 06:55:06 2019 +0100
     2.2 +++ b/sync/sync.fsm	Thu Mar 28 13:44:04 2019 +0100
     2.3 @@ -42,7 +42,6 @@
     2.4                      do openTransaction;
     2.5                      do storeTransaction;
     2.6                      send HandshakeRequest;
     2.7 -                    go HandshakeRequested;
     2.8                  }
     2.9              }
    2.10  
    2.11 @@ -55,9 +54,7 @@
    2.12                      go HandshakingNew;
    2.13                  }
    2.14              }
    2.15 -        }
    2.16  
    2.17 -        state HandshakeRequested {
    2.18              on HandshakeAnswer
    2.19                  go HandshakingNew;
    2.20          }