Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak IAP transport to only delay control sessions, not data sessions #1385

Merged
merged 4 commits into from
Oct 9, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions SmartDeviceLink/SDLIAPTransport.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ - (void)sdl_stopEventListening {
* @param notification Contains information about the connected accessory
*/
- (void)sdl_accessoryConnected:(NSNotification *)notification {
EAAccessory *newAccessory = [notification.userInfo objectForKey:EAAccessoryKey];
EAAccessory *newAccessory = notification.userInfo[EAAccessoryKey];

if ([self sdl_isDataSessionActive:self.dataSession newAccessory:newAccessory]) {
self.accessoryConnectDuringActiveSession = YES;
return;
}

double retryDelay = self.sdl_retryDelay;
SDLLogD(@"Accessory Connected (%@), Opening in %0.03fs", notification.userInfo[EAAccessoryKey], retryDelay);
SDLLogD(@"Accessory Connected (%@), Opening in %0.03fs", newAccessory, retryDelay);
NicoleYarroch marked this conversation as resolved.
Show resolved Hide resolved

self.retryCounter = 0;
[self performSelector:@selector(sdl_connect:) withObject:nil afterDelay:retryDelay];
[self sdl_connect:newAccessory];
}

/**
Expand Down Expand Up @@ -304,6 +304,7 @@ - (void)controlSessionShouldRetry {
* @param protocolString The protocol string to be used to open the data session
*/
- (void)controlSession:(nonnull SDLIAPControlSession *)controlSession didReceiveProtocolString:(nonnull NSString *)protocolString {
SDLLogD(@"Control transport session received data session number: %@", protocolString);
self.dataSession = [[SDLIAPDataSession alloc] initWithAccessory:controlSession.accessory delegate:self forProtocol:protocolString];
[self.dataSession startSession];
}
Expand Down Expand Up @@ -499,7 +500,7 @@ - (BOOL)createSessionWithAccessory:(EAAccessory *)accessory protocolString:(NSSt
return YES;
} else if ([protocolString isEqualToString:ControlProtocolString]) {
self.controlSession = [[SDLIAPControlSession alloc] initWithAccessory:accessory delegate:self];
[self.controlSession startSession];
[self.controlSession performSelector:@selector(startSession) withObject:nil afterDelay:[self sdl_retryDelay]];
return YES;
} else if ([protocolString isEqualToString:LegacyProtocolString]) {
self.dataSession = [[SDLIAPDataSession alloc] initWithAccessory:accessory delegate:self forProtocol:protocolString];
Expand Down