Sync : added PEP_MESSAGE_DISCARDED keysync
authorEdouard Tisserant <edouard@pep-project.org>
Tue, 20 Sep 2016 15:55:38 +0200
branchkeysync
changeset 11708949bee99bcd
parent 1167 781218f0c0d0
child 1171 da88e97231f9
Sync : added PEP_MESSAGE_DISCARDED
src/message_api.c
src/pEpEngine.h
src/sync_impl.c
     1.1 --- a/src/message_api.c	Tue Sep 20 11:46:59 2016 +0200
     1.2 +++ b/src/message_api.c	Tue Sep 20 15:55:38 2016 +0200
     1.3 @@ -1407,10 +1407,11 @@
     1.4                  remove_attached_keys(src);
     1.5              if (session->retrieve_next_sync_msg) {
     1.6                  status = receive_DeviceState_msg(session, src, *rating, *keylist);
     1.7 -                if (status == PEP_MESSAGE_CONSUMED) {
     1.8 +                if (status == PEP_MESSAGE_CONSUMED || 
     1.9 +                    status == PEP_MESSAGE_DISCARDED) {
    1.10                      free_message(msg);
    1.11                      msg = NULL;
    1.12 -                    return PEP_MESSAGE_CONSUMED;
    1.13 +                    return status;
    1.14                  }
    1.15                  else if (status != PEP_STATUS_OK) {
    1.16                      return status;
    1.17 @@ -1682,7 +1683,8 @@
    1.18              remove_attached_keys(msg);
    1.19          if (*rating >= PEP_rating_reliable && session->retrieve_next_sync_msg) {
    1.20              status = receive_DeviceState_msg(session, msg, *rating, _keylist);
    1.21 -            if (status == PEP_MESSAGE_CONSUMED) {
    1.22 +            if (status == PEP_MESSAGE_CONSUMED || 
    1.23 +                status == PEP_MESSAGE_DISCARDED) {
    1.24                  free_message(msg);
    1.25                  msg = NULL;
    1.26              }
     2.1 --- a/src/pEpEngine.h	Tue Sep 20 11:46:59 2016 +0200
     2.2 +++ b/src/pEpEngine.h	Tue Sep 20 15:55:38 2016 +0200
     2.3 @@ -91,6 +91,7 @@
     2.4  
     2.5      PEP_COMMIT_FAILED                               = 0xff01,
     2.6      PEP_MESSAGE_CONSUMED                            = 0xff02,
     2.7 +    PEP_MESSAGE_DISCARDED                           = 0xff03,
     2.8  
     2.9      PEP_RECORD_NOT_FOUND                            = -6,
    2.10      PEP_CANNOT_CREATE_TEMP_FILE                     = -5,
     3.1 --- a/src/sync_impl.c	Tue Sep 20 11:46:59 2016 +0200
     3.2 +++ b/src/sync_impl.c	Tue Sep 20 15:55:38 2016 +0200
     3.3 @@ -149,7 +149,8 @@
     3.4                      }
     3.5                  }
     3.6                  else if (status == PEP_OWN_SEQUENCE) {
     3.7 -                    goto skip;
     3.8 +                    ASN_STRUCT_FREE(asn_DEF_DeviceGroup_Protocol, msg);
     3.9 +                    return PEP_MESSAGE_DISCARDED;
    3.10                  }
    3.11              }
    3.12