Merge branch 'IPS-197'

master
Dirk Zimmermann 2022-03-14 10:02:26 +01:00
commit 87b0230283
3 changed files with 6 additions and 15 deletions

View File

@ -34,6 +34,7 @@
error:&error];
XCTAssertNotNil(self.transport);
XCTAssertNil(error);
self.transport.delayedStartupStatusCode = [NSNumber numberWithInteger:PEPTransportStatusCodeConnectionUp];
self.transportDelegate = [MockBlockBasedTransportDelegate new];

View File

@ -95,10 +95,9 @@ static const PEPTransportID s_transportID = PEPTransportIDTransportAuto;
return YES;
} else {
// We are able to start up immediately and know it's a success.
// No message to the delegate.
*transportStatusCode = PEPTransportStatusCodeConnectionUp;
return YES;
NSAssert(NO, @"TransportMock must be configured with either directStartupStatusCode or delayedStartupStatusCode");
*transportStatusCode = PEPTransportStatusCodeConfigIncompleteOrWrong;
return NO;
}
}

View File

@ -62,17 +62,8 @@
BOOL success = [self.transport startupWithTransportStatusCode:&statusCode error:&error];
if (success) {
if (statusCode == PEPTransportStatusCodeConnectionUp) {
// This is already up, so assume there's no need to wait for more.
// Remove our callback, and inform the caller.
[self.startupCallbacks removeObject:callbacks];
successCallback(statusCode);
} else {
// Note the assumptions here:
// * No error has occurred, but the transport is not yet up.
// * We don't report that, since we consider it an intermediate step.
// * Instead, we wait for further delegate notifications.
}
// In case of success, the transport is required to inform the delegate about
// PEPTransportStatusCodeConnectionUp asynchronously. Nothing left to do here.
} else {
// Immediate error. Remove our callback, and inform the caller.
// Transport could not be started.