summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2019-10-21 10:25:00 -0400
committerNicoleYarroch <nicole@livio.io>2019-10-21 10:25:00 -0400
commit49fda951ef4bb2d1f245a89324d7bd87bfddfde0 (patch)
tree0d196fec30c2138598b611fd5a2f2460455a0696
parent1a61b70c769d09cf58df30f7899c0826fe0bcc8b (diff)
downloadsdl_ios-bugfix/issue_1431_multiple_phones_disconnect_bug.tar.gz
Session is not disconnected if connectionID does not matchbugfix/issue_1431_multiple_phones_disconnect_bug
-rw-r--r--SmartDeviceLink/SDLIAPTransport.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLIAPTransport.m b/SmartDeviceLink/SDLIAPTransport.m
index 5c6da5635..f65027e49 100644
--- a/SmartDeviceLink/SDLIAPTransport.m
+++ b/SmartDeviceLink/SDLIAPTransport.m
@@ -140,10 +140,18 @@ int const CreateSessionRetries = 3;
SDLLogV(@"Accessory (%@, %@), disconnected, but no session is in progress.", accessory.name, accessory.serialNumber);
[self sdl_closeSessions];
} else if (self.dataSession.isSessionInProgress) {
+ if (self.dataSession.connectionID != accessory.connectionID) {
+ SDLLogD(@"Accessory's connectionID, %lu, does not match the connectionID of the current data session, %lu. Another phone disconnected from the head unit. The session will not be closed.", accessory.connectionID, self.dataSession.connectionID);
+ return;
+ }
// The data session has been established. Tell the delegate that the transport has disconnected. The lifecycle manager will destroy and create a new transport object.
SDLLogV(@"Accessory (%@, %@) disconnected during a data session", accessory.name, accessory.serialNumber);
[self sdl_destroyTransport];
} else if (self.controlSession.isSessionInProgress) {
+ if (self.controlSession.connectionID != accessory.connectionID) {
+ SDLLogD(@"Accessory's connectionID, %lu, does not match the connectionID of the current control session, %lu. Another phone disconnected from the head unit. The session will not be closed.", accessory.connectionID, self.controlSession.connectionID);
+ return;
+ }
// The data session has yet to be established so the transport has not yet connected. DO NOT unregister for notifications from the accessory.
SDLLogV(@"Accessory (%@, %@) disconnected during a control session", accessory.name, accessory.serialNumber);
[self sdl_closeSessions];