IOSAD-141 Don't share session between threads. IOSAD-141
authorDirk Zimmermann <dz@pep.security>
Thu, 12 Sep 2019 16:41:52 +0200
branchIOSAD-141
changeset 1245cd15ff3a40b9
parent 1244 d780d1356405
child 1246 9fc7a345f0a3
IOSAD-141 Don't share session between threads.
pEpObjCTests/PEPSessionTest.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Thu Sep 12 16:41:52 2019 +0200
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Thu Sep 12 16:41:52 2019 +0200
     1.3 @@ -1458,9 +1458,6 @@
     1.4                                                      session: nil];
     1.5      XCTAssertNotNil(bobIdent);
     1.6  
     1.7 -    // Mix sessions between threads.
     1.8 -    __block PEPSession *sharedSession;
     1.9 -
    1.10      for (int iOuter = 0; iOuter < 1000; ++iOuter) {
    1.11          XCTestExpectation *expThread1Finished = [self expectationWithDescription:@"Thread1 finished"];
    1.12          NSThread *thread1 = [[NSThread alloc] initWithBlock:^{
    1.13 @@ -1476,11 +1473,6 @@
    1.14              for (int i = 0; i < 100; ++i) {
    1.15                  NSLog(@"outgoingRatingForMessage %d\n", i);
    1.16  
    1.17 -                // Mix sessions between threads.
    1.18 -                if (sharedSession == nil) {
    1.19 -                    sharedSession = session1;
    1.20 -                }
    1.21 -
    1.22                  NSError *error = nil;
    1.23                  NSNumber *num = [session1 outgoingRatingForMessage:msg error:&error1];
    1.24                  XCTAssertNotNil(num);
    1.25 @@ -1498,11 +1490,6 @@
    1.26              for (int i = 0; i < 2000; ++i) {
    1.27                  NSLog(@"getTrustwordsIdentity1 %d\n", i);
    1.28  
    1.29 -                // Mix sessions between threads.
    1.30 -                if (sharedSession != nil) {
    1.31 -                    session2 = sharedSession;
    1.32 -                }
    1.33 -
    1.34                  NSString *trustwords = [session2
    1.35                                          getTrustwordsIdentity1:aliceIdent
    1.36                                          identity2:bobIdent