summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2020-07-21 08:14:06 -0400
committerNicoleYarroch <nicole@livio.io>2020-07-21 08:14:06 -0400
commit618e53c98f008f5082544cbbf1ae7a36d6b67df2 (patch)
treed9590767a80d606aa5059f7a30e95c8a9c1c7cea
parente9b134526ffde9ca25b2c20682f259dcfa81b7a9 (diff)
downloadsdl_ios-618e53c98f008f5082544cbbf1ae7a36d6b67df2.tar.gz
Added more protocol checks
Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r--SmartDeviceLink/SDLSecondaryTransportManager.m15
1 files changed, 9 insertions, 6 deletions
diff --git a/SmartDeviceLink/SDLSecondaryTransportManager.m b/SmartDeviceLink/SDLSecondaryTransportManager.m
index a69fa6604..fe8cd4338 100644
--- a/SmartDeviceLink/SDLSecondaryTransportManager.m
+++ b/SmartDeviceLink/SDLSecondaryTransportManager.m
@@ -403,7 +403,8 @@ struct TransportProtocolUpdated {
#pragma mark Primary transport
- (void)handleProtocolStartServiceACKMessage:(SDLProtocolMessage *)startServiceACK protocol:(SDLProtocol *)protocol {
- if (startServiceACK.header.serviceType != SDLServiceTypeRPC) { return; }
+ if (startServiceACK.header.serviceType != SDLServiceTypeRPC || self.primaryProtocol != protocol) { return; }
+
SDLLogV(@"Received Start Service ACK header of RPC service on primary (%@) transport", protocol.transport);
// Keep header to acquire Session ID
@@ -415,6 +416,8 @@ struct TransportProtocolUpdated {
}
- (void)handleTransportEventUpdateMessage:(SDLProtocolMessage *)transportEventUpdate protocol:(SDLProtocol *)protocol {
+ if (self.primaryProtocol != protocol) { return; }
+
SDLControlFramePayloadTransportEventUpdate *payload = [[SDLControlFramePayloadTransportEventUpdate alloc] initWithData:transportEventUpdate.payload];
SDLLogV(@"Recieved transport event update on primary (%@) transport: %@", protocol.transport, payload);
@@ -542,7 +545,7 @@ struct TransportProtocolUpdated {
// called on transport's thread, notifying that the transport is established
- (void)onProtocolOpened:(SDLProtocol *)protocol {
// The primary transport opened
- if (protocol != self.secondaryProtocol) { return; }
+ if (self.secondaryProtocol != protocol) { return; }
SDLLogD(@"Secondary transport connected");
@@ -574,7 +577,7 @@ struct TransportProtocolUpdated {
/// @param error The error
/// @param protocol The protocol
- (void)onTransportError:(NSError *)error protocol:(SDLProtocol *)protocol {
- if (protocol != self.secondaryProtocol) { return; }
+ if (self.secondaryProtocol != protocol) { return; }
SDLLogE(@"The secondary transport errored.");
[self sdl_transportClosed];
@@ -584,7 +587,7 @@ struct TransportProtocolUpdated {
/// @discussion When the transport's disconnect method is called, this method will not be called.
/// @param protocol The protocol
- (void)onProtocolClosed:(SDLProtocol *)protocol{
- if (protocol != self.secondaryProtocol) { return; }
+ if (self.secondaryProtocol != protocol) { return; }
SDLLogE(@"The secondary transport disconnected.");
[self sdl_transportClosed];
@@ -605,7 +608,7 @@ struct TransportProtocolUpdated {
// called from SDLProtocol's _receiveQueue of secondary transport
- (void)handleProtocolRegisterSecondaryTransportACKMessage:(SDLProtocolMessage *)registerSecondaryTransportACK protocol:(SDLProtocol *)protocol {
- if (protocol != self.secondaryProtocol) { return; }
+ if (self.secondaryProtocol != protocol) { return; }
SDLLogD(@"Received Register Secondary Transport ACK frame");
dispatch_async(self.stateMachineQueue, ^{
@@ -616,7 +619,7 @@ struct TransportProtocolUpdated {
// called from SDLProtocol's _receiveQueue of secondary transport
- (void)handleProtocolRegisterSecondaryTransportNAKMessage:(SDLProtocolMessage *)registerSecondaryTransportNAK protocol:(SDLProtocol *)protocol {
- if (protocol != self.secondaryProtocol) { return; }
+ if (self.secondaryProtocol != protocol) { return; }
SDLLogW(@"Received Register Secondary Transport NAK frame");
dispatch_async(self.stateMachineQueue, ^{