pEpObjCTests/TestUtils/PEPTestSyncDelegate.m
author Dirk Zimmermann <dirk@pep-project.org>
Tue, 24 Apr 2018 13:29:19 +0200
branchIOSAD-92
changeset 594 a9cae3a6f78d
parent 391 3a63cf867f1f
permissions -rw-r--r--
IOSAD-92 PEPIdentity using hashBasedOnKeys etc.
     1 //
     2 //  PEPTestSyncDelegate.m
     3 //  pEpObjCAdapter
     4 //
     5 //  Created by Andreas Buff on 18.01.18.
     6 //  Copyright © 2018 p≡p. All rights reserved.
     7 //
     8 
     9 #import "PEPTestSyncDelegate.h"
    10 
    11 @implementation PEPTestSyncDelegate
    12 
    13 - (id)init
    14 {
    15     if (self = [super init])  {
    16         self.sendWasCalled = false;
    17         self.cond = [[NSCondition alloc] init];
    18     }
    19     return self;
    20 }
    21 
    22 - (PEP_STATUS)notifyHandshakeWithSignal:(sync_handshake_signal)signal me:(id)me
    23 partner:(id)partner
    24 {
    25     return PEP_STATUS_OK;
    26 }
    27 
    28 - (PEP_STATUS)sendMessage:(id)msg
    29 {
    30     [_cond lock];
    31 
    32     self.sendWasCalled = true;
    33     [_cond signal];
    34     [_cond unlock];
    35 
    36     return PEP_STATUS_OK;
    37 }
    38 
    39 - (PEP_STATUS)fastPolling:(bool)isfast
    40 {
    41     return PEP_STATUS_OK;
    42 }
    43 
    44 - (BOOL)waitUntilSent:(time_t)maxSec
    45 {
    46     bool res;
    47     [_cond lock];
    48     [_cond waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:maxSec]];
    49     res = _sendWasCalled;
    50     [_cond unlock];
    51     return res;
    52 }
    53 
    54 @end