pEpObjCAdapter/PEPSession.m
changeset 251 0002fa8d58fa
parent 250 371630c05842
child 253 8b302fa1d5c6
     1.1 --- a/pEpObjCAdapter/PEPSession.m	Thu Sep 28 18:40:25 2017 +0200
     1.2 +++ b/pEpObjCAdapter/PEPSession.m	Thu Sep 28 18:40:44 2017 +0200
     1.3 @@ -18,37 +18,6 @@
     1.4  
     1.5  @implementation PEPSession
     1.6  
     1.7 -// serialize all session access
     1.8 -+ (dispatch_queue_t)sharedSessionQueue
     1.9 -{
    1.10 -    static dispatch_once_t once;
    1.11 -    static dispatch_queue_t sharedSessionQueue;
    1.12 -    dispatch_once(&once, ^{
    1.13 -        sharedSessionQueue = dispatch_queue_create("pEp session queue", DISPATCH_QUEUE_CONCURRENT);
    1.14 -    });
    1.15 -    return sharedSessionQueue;
    1.16 -}
    1.17 -
    1.18 -+ (PEPSession *)session
    1.19 -{
    1.20 -    PEPSession *_session = [[PEPSession alloc] init];
    1.21 -    return _session;
    1.22 -}
    1.23 -
    1.24 -+ (void)dispatchAsyncOnSession:(PEPSessionBlock)block
    1.25 -{
    1.26 -    dispatch_async([self sharedSessionQueue], ^{
    1.27 -        PEPSession *pepSession = [[PEPSession alloc] init];
    1.28 -        block(pepSession);
    1.29 -    });
    1.30 -}
    1.31 -
    1.32 -+ (void)dispatchSyncOnSession:(PEPSessionBlock)block
    1.33 -{
    1.34 -    PEPSession *pepSession = [[PEPSession alloc] init];
    1.35 -    block(pepSession);
    1.36 -}
    1.37 -
    1.38  + (void)setupTrustWordsDB
    1.39  {
    1.40      static dispatch_once_t once;
    1.41 @@ -57,28 +26,18 @@
    1.42      });
    1.43  }
    1.44  
    1.45 -static NSString *threadCountKey = @"PEPSession.threadCount";
    1.46 -//static NSObject *sessionInitLock = nil;
    1.47 -//static dispatch_once_t sessionInitLockOnce;
    1.48 -
    1.49  - (id)init
    1.50  {
    1.51      [PEPSession setupTrustWordsDB];
    1.52      
    1.53 -    // dispatch_once(&sessionInitLockOnce, ^{
    1.54 -    //     sessionInitLock = [[NSObject alloc] init];
    1.55 -    // });
    1.56 -    // @synchronized (sessionInitLock)
    1.57 -    {
    1.58 +    PEP_STATUS status = init(&_session);
    1.59  
    1.60 -        PEP_STATUS status = init(&_session);
    1.61 +    if (status != PEP_STATUS_OK) {
    1.62 +        return nil;
    1.63 +    }
    1.64  
    1.65 -        if (status != PEP_STATUS_OK) {
    1.66 -            return nil;
    1.67 -        }
    1.68 +    [PEPObjCAdapter bindSession:self];
    1.69  
    1.70 -        [PEPObjCAdapter bindSession:self];
    1.71 -    }
    1.72      return self;
    1.73  }
    1.74  
    1.75 @@ -86,10 +45,8 @@
    1.76  {
    1.77      [PEPObjCAdapter unbindSession:self];
    1.78  
    1.79 -    // @synchronized (sessionInitLock)
    1.80 -    {
    1.81 -        release(_session);
    1.82 -    }
    1.83 +    release(_session);
    1.84 +
    1.85  }
    1.86  
    1.87  /**