pEpObjCAdapter/PEPSync.m
author Dirk Zimmermann <dz@pep.security>
Thu, 21 Mar 2019 15:02:02 +0100
branchIOS-1475_exp_dirk_001
changeset 905 929095fe2998
parent 901 aba7ae6ea8ae
parent 902 32760267cd59
permissions -rw-r--r--
IOS-1475 Merge in refactor.
     1 //
     2 //  PEPSync.m
     3 //  pEpObjCAdapter
     4 //
     5 //  Created by Dirk Zimmermann on 04.10.18.
     6 //  Copyright © 2018 p≡p. All rights reserved.
     7 //
     8 
     9 #import "PEPSync.h"
    10 
    11 #import "PEPSendMessageDelegate.h"
    12 #import "PEPMessageUtil.h"
    13 #import "PEPMessage.h"
    14 #import "PEPQueue.h"
    15 #import "PEPLock.h"
    16 #import <PEPObjCAdapterFramework/PEPObjCAdapter.h>
    17 #import "NSError+PEP+Internal.h"
    18 #import "PEPSessionProvider.h"
    19 #import "PEPInternalSession.h"
    20 
    21 @implementation PEPSync
    22 
    23 + (PEP_SESSION)createSession:(NSError **)error
    24 {
    25     PEP_SESSION session = NULL;
    26 
    27     [PEPLock lockWrite];
    28     PEP_STATUS status = init(&session);
    29     [PEPLock unlockWrite];
    30 
    31     if (status != PEP_STATUS_OK) {
    32         if (error) {
    33             *error = [NSError errorWithPEPStatusInternal:status];
    34         }
    35         return nil;
    36     }
    37 
    38     return session;
    39 }
    40 
    41 + (void)releaseSession:(PEP_SESSION)session
    42 {
    43     [PEPLock lockWrite];
    44     release(session);
    45     [PEPLock unlockWrite];
    46 }
    47 
    48 @end