IOSAD-139 Empty sync queue when starting up. IOSAD-139
authorDirk Zimmermann <dz@pep.security>
Fri, 20 Sep 2019 13:02:09 +0200
branchIOSAD-139
changeset 12530532de0ff84a
parent 1252 e43abf52f198
child 1274 13c0d771db28
IOSAD-139 Empty sync queue when starting up.
pEpObjCAdapter/PEPQueue.h
pEpObjCAdapter/PEPQueue.m
pEpObjCAdapter/PEPSync.m
     1.1 --- a/pEpObjCAdapter/PEPQueue.h	Fri Sep 20 13:02:09 2019 +0200
     1.2 +++ b/pEpObjCAdapter/PEPQueue.h	Fri Sep 20 13:02:09 2019 +0200
     1.3 @@ -22,4 +22,9 @@
     1.4  
     1.5  - (void)purge:(deleteOp)del;
     1.6  
     1.7 +/**
     1.8 + Removes all objects from the queue.
     1.9 + */
    1.10 +- (void)removeAllObjects;
    1.11 +
    1.12  @end
     2.1 --- a/pEpObjCAdapter/PEPQueue.m	Fri Sep 20 13:02:09 2019 +0200
     2.2 +++ b/pEpObjCAdapter/PEPQueue.m	Fri Sep 20 13:02:09 2019 +0200
     2.3 @@ -116,6 +116,16 @@
     2.4      [_cond unlock];
     2.5  }
     2.6  
     2.7 +- (void)removeAllObjects
     2.8 +{
     2.9 +    [_cond lock];
    2.10 +
    2.11 +    [self.queue removeAllObjects];
    2.12 +
    2.13 +    [_cond signal];
    2.14 +    [_cond unlock];
    2.15 +}
    2.16 +
    2.17  
    2.18  - (void)dealloc
    2.19  {
     3.1 --- a/pEpObjCAdapter/PEPSync.m	Fri Sep 20 13:02:09 2019 +0200
     3.2 +++ b/pEpObjCAdapter/PEPSync.m	Fri Sep 20 13:02:09 2019 +0200
     3.3 @@ -157,6 +157,9 @@
     3.4  
     3.5  - (void)startup
     3.6  {
     3.7 +    // Make sure queue is empty when we start.
     3.8 +    [self.queue removeAllObjects];
     3.9 +
    3.10      [self assureMainSessionExists];
    3.11  
    3.12      self.conditionLockForJoiningSyncThread = [[NSConditionLock alloc] initWithCondition:NO];