IOSAD-103 make PEPSync use PEPSessionProvider IOSAD-103
authorDirk Zimmermann <dirk@pep-project.org>
Wed, 31 Oct 2018 16:38:25 +0100
branchIOSAD-103
changeset 751ac9e7fee47c2
parent 750 c29db2e0851e
child 752 24b965f26c56
IOSAD-103 make PEPSync use PEPSessionProvider
pEpObjCAdapter/PEPSync.m
     1.1 --- a/pEpObjCAdapter/PEPSync.m	Wed Oct 31 16:38:25 2018 +0100
     1.2 +++ b/pEpObjCAdapter/PEPSync.m	Wed Oct 31 16:38:25 2018 +0100
     1.3 @@ -16,6 +16,8 @@
     1.4  #import "PEPLock.h"
     1.5  #import "PEPObjCAdapter.h"
     1.6  #import "NSError+PEP.h"
     1.7 +#import "PEPSessionProvider.h"
     1.8 +#import "PEPInternalSession.h"
     1.9  
    1.10  // MARK: - Declare internals
    1.11  
    1.12 @@ -182,18 +184,17 @@
    1.13  {
    1.14      [self.conditionLockForJoiningSyncThread lock];
    1.15  
    1.16 -    NSError *error = nil;
    1.17 -    PEP_SESSION session = [PEPSync createSession:&error];
    1.18 +    PEPInternalSession *session = [PEPSessionProvider session];
    1.19  
    1.20      if (session) {
    1.21 -        register_sync_callbacks(session, nil, s_notifyHandshake, s_retrieve_next_sync_event);
    1.22 -        do_sync_protocol(session, nil);
    1.23 -        unregister_sync_callbacks(session);
    1.24 +        register_sync_callbacks(session.session, nil, s_notifyHandshake, s_retrieve_next_sync_event);
    1.25 +        do_sync_protocol(session.session, nil);
    1.26 +        unregister_sync_callbacks(session.session);
    1.27      } else {
    1.28          // indicate error, maybe through `object`?
    1.29      }
    1.30  
    1.31 -    [PEPSync releaseSession:session];
    1.32 +    session = nil;
    1.33  
    1.34      [self.conditionLockForJoiningSyncThread unlockWithCondition:YES];
    1.35  }