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