summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2020-02-07 10:56:39 -0500
committerJoel Fischer <joeljfischer@gmail.com>2020-02-07 10:56:39 -0500
commit6bb81a85883bf58d035e5d5b885c272b044547d7 (patch)
tree5c3d5f09e2ca102e984e8dabc317d2e7d667c0da
parent42f8e834c22d8356b7b46c8ae9d666e28ae7b0aa (diff)
downloadsdl_ios-bugfix/issue-1240-remove-data-session-delay.tar.gz
Remove the delay on data sessionsbugfix/issue-1240-remove-data-session-delay
* This means that multi-session connections will not be delayed
-rw-r--r--SmartDeviceLink/SDLIAPDataSession.m3
-rw-r--r--SmartDeviceLink/SDLIAPTransport.m13
2 files changed, 11 insertions, 5 deletions
diff --git a/SmartDeviceLink/SDLIAPDataSession.m b/SmartDeviceLink/SDLIAPDataSession.m
index 5bf61e304..e2341383c 100644
--- a/SmartDeviceLink/SDLIAPDataSession.m
+++ b/SmartDeviceLink/SDLIAPDataSession.m
@@ -110,6 +110,9 @@ NS_ASSUME_NONNULL_BEGIN
[self sdl_isIOThreadCanceled:self.canceledSemaphore completionHandler:^(BOOL success) {
if (success == NO) {
SDLLogE(@"Destroying thread (IOStreamThread) for data session when I/O streams have not yet closed.");
+
+ // FIX: Try to close the session if the canceledSemaphore is never triggered by the `sdl_accessoryEventLoop`
+ [self sdl_closeSession];
}
self.ioStreamThread = nil;
[super cleanupClosedSession];
diff --git a/SmartDeviceLink/SDLIAPTransport.m b/SmartDeviceLink/SDLIAPTransport.m
index a1be67a65..425e150d4 100644
--- a/SmartDeviceLink/SDLIAPTransport.m
+++ b/SmartDeviceLink/SDLIAPTransport.m
@@ -98,11 +98,8 @@ int const CreateSessionRetries = 3;
return;
}
- double retryDelay = self.sdl_retryDelay;
- SDLLogD(@"Accessory Connected (%@), Opening in %0.03fs", notification.userInfo[EAAccessoryKey], retryDelay);
-
self.retryCounter = 0;
- [self performSelector:@selector(sdl_connect:) withObject:nil afterDelay:retryDelay];
+ [self sdl_connect:newAccessory];
}
/**
@@ -508,10 +505,16 @@ int const CreateSessionRetries = 3;
return YES;
} else if ([protocolString isEqualToString:ControlProtocolString]) {
self.controlSession = [[SDLIAPControlSession alloc] initWithAccessory:accessory delegate:self];
- [self.controlSession startSession];
+
+ double retryDelay = [self sdl_retryDelay];
+ SDLLogD(@"Accessory Connected (%@), Opening in %0.03fs", accessory, retryDelay);
+ [self.controlSession performSelector:@selector(startSession) withObject:nil afterDelay:retryDelay];
+
return YES;
} else if ([protocolString isEqualToString:LegacyProtocolString]) {
self.dataSession = [[SDLIAPDataSession alloc] initWithAccessory:accessory delegate:self forProtocol:protocolString];
+
+ SDLLogD(@"Accessory Connected (%@), Opening immediately", accessory);
[self.dataSession startSession];
return YES;
}