pEpObjCAdapter/PEPSessionProvider.m
changeset 627 2f9d21f8b1a6
parent 625 6da48501887b
child 636 11d6508b7c62
     1.1 --- a/pEpObjCAdapter/PEPSessionProvider.m	Wed Jun 13 10:49:35 2018 +0200
     1.2 +++ b/pEpObjCAdapter/PEPSessionProvider.m	Wed Jun 13 11:19:35 2018 +0200
     1.3 @@ -106,17 +106,24 @@
     1.4   */
     1.5  + (void)assureSessionForMainThreadExists
     1.6  {
     1.7 +    // shared code to set global configuration every time
     1.8 +    void (^configurationBlock)(void) = ^{
     1.9 +        [self setConfigUnEncryptedSubjectOnSession:s_sessionForMainThread];
    1.10 +        [self setPassiveModeOnSession:s_sessionForMainThread];
    1.11 +    };
    1.12 +
    1.13      if (s_sessionForMainThread) {
    1.14 +        configurationBlock();
    1.15          return;
    1.16      }
    1.17  
    1.18 +    // shared code that is executed in any case, either on the main thread or in the background
    1.19      void (^creationBlock)(void) = ^{
    1.20          if (s_sessionForMainThread) {
    1.21              return;
    1.22          }
    1.23          s_sessionForMainThread = [PEPInternalSession new];
    1.24 -        [self setConfigUnEncryptedSubjectOnSession:s_sessionForMainThread];
    1.25 -        [self setPassiveModeOnSession:s_sessionForMainThread];
    1.26 +        configurationBlock();
    1.27      };
    1.28  
    1.29