IOSAD-98 keep on re-configuring main session
authorDirk Zimmermann <dirk@pep-project.org>
Tue, 04 Sep 2018 13:55:01 +0200
changeset 648946895afd5f8
parent 647 d8830e5d240e
child 649 090fa902a419
IOSAD-98 keep on re-configuring main session
pEpObjCAdapter/PEPSessionProvider.m
     1.1 --- a/pEpObjCAdapter/PEPSessionProvider.m	Tue Sep 04 13:55:01 2018 +0200
     1.2 +++ b/pEpObjCAdapter/PEPSessionProvider.m	Tue Sep 04 13:55:01 2018 +0200
     1.3 @@ -31,6 +31,7 @@
     1.4      [self assureSessionForMainThreadExists];
     1.5  
     1.6      if ([NSThread isMainThread]) {
     1.7 +        [self configureSession:s_sessionForMainThread];
     1.8          return s_sessionForMainThread;
     1.9      }
    1.10  
    1.11 @@ -44,8 +45,7 @@
    1.12      }
    1.13  
    1.14      // configuration
    1.15 -    [self setConfigUnEncryptedSubjectOnSession:newOrExistingSession];
    1.16 -    [self setPassiveModeOnSession:newOrExistingSession];
    1.17 +    [self configureSession:newOrExistingSession];
    1.18  
    1.19      [self nullifySessionsOfFinishedThreads];
    1.20  
    1.21 @@ -85,6 +85,12 @@
    1.22  
    1.23  #pragma mark - configuration
    1.24  
    1.25 ++ (void)configureSession:(PEPInternalSession *)session
    1.26 +{
    1.27 +    [self setConfigUnEncryptedSubjectOnSession:session];
    1.28 +    [self setPassiveModeOnSession:session];
    1.29 +}
    1.30 +
    1.31  + (void)setConfigUnEncryptedSubjectOnSession:(PEPInternalSession *)session
    1.32  {
    1.33      BOOL unEncryptedSubjectEnabled = [PEPObjCAdapter unEncryptedSubjectEnabled];
    1.34 @@ -107,8 +113,7 @@
    1.35      // shared code to set global configuration every time
    1.36      void (^configurationBlock)(void) = ^{
    1.37          [[self sessionForThreadLock] lock];
    1.38 -        [self setConfigUnEncryptedSubjectOnSession:s_sessionForMainThread];
    1.39 -        [self setPassiveModeOnSession:s_sessionForMainThread];
    1.40 +        [self configureSession:s_sessionForMainThread];
    1.41          [[self sessionForThreadLock] unlock];
    1.42      };
    1.43