summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2017-09-07 17:51:32 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2017-09-08 09:24:59 -0400
commitda4b5766ca3f1fca4caa4b4815073f72dfe37182 (patch)
tree3401a5b008c209811fb6c5022a2c86f44a555cc7
parent316f1775ff39b7af1860ed43a446739be501f4b0 (diff)
parentbff6e483eb80a0563159d825dd7ba636815c402d (diff)
downloadsdl_core-da4b5766ca3f1fca4caa4b4815073f72dfe37182.tar.gz
Merge remote-tracking branch 'LuxoftAKutsan/fix/SDL_respond_ACK_with_protocol_version_4_for_video_and_audio_services_instead_of_negotiatied_version_protocol' into develop
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h2
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc31
2 files changed, 21 insertions, 12 deletions
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
index 7521137d5a..c5a45c0dfe 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
@@ -247,7 +247,7 @@ class ProtocolHandlerImpl
*/
void SendStartSessionAck(ConnectionID connection_id,
uint8_t session_id,
- uint8_t protocol_version,
+ uint8_t input_protocol_version,
uint32_t hash_code,
uint8_t service_type,
bool protection);
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index 125e033147..ec4663764a 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -190,7 +190,7 @@ void set_hash_id(uint32_t hash_id, protocol_handler::ProtocolPacket& packet) {
void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id,
uint8_t session_id,
- uint8_t protocol_version,
+ uint8_t input_protocol_version,
uint32_t hash_id,
uint8_t service_type,
bool protection) {
@@ -198,7 +198,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id,
ProtocolPacket::ProtocolVersion fullVersion;
SendStartSessionAck(connection_id,
session_id,
- protocol_version,
+ input_protocol_version,
hash_id,
service_type,
protection,
@@ -208,7 +208,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id,
void ProtocolHandlerImpl::SendStartSessionAck(
ConnectionID connection_id,
uint8_t session_id,
- uint8_t protocol_version,
+ uint8_t input_protocol_version,
uint32_t hash_id,
uint8_t service_type,
bool protection,
@@ -220,7 +220,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
SendStartSessionAck(connection_id,
session_id,
- protocol_version,
+ input_protocol_version,
hash_id,
service_type,
protection,
@@ -233,7 +233,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
void ProtocolHandlerImpl::SendStartSessionAck(
ConnectionID connection_id,
uint8_t session_id,
- uint8_t protocol_version,
+ uint8_t input_protocol_version,
uint32_t hash_id,
uint8_t service_type,
bool protection,
@@ -241,22 +241,31 @@ void ProtocolHandlerImpl::SendStartSessionAck(
BsonObject& params) {
LOG4CXX_AUTO_TRACE(logger_);
- uint8_t maxProtocolVersion = SupportedSDLProtocolVersion();
+ uint8_t ack_protocol_version = SupportedSDLProtocolVersion();
const bool proxy_supports_v5_protocol =
- protocol_version >= PROTOCOL_VERSION_5 ||
+ input_protocol_version >= PROTOCOL_VERSION_5 ||
(ServiceTypeFromByte(service_type) == kRpc &&
full_version.majorVersion >= PROTOCOL_VERSION_5);
+ if (kRpc != service_type) {
+ // In case if input protocol version os bigger then supported, SDL should
+ // respond with maximum supported protocol version
+ ack_protocol_version = input_protocol_version < ack_protocol_version
+ ? input_protocol_version
+ : ack_protocol_version;
+ }
+
// We can't send a V5+ packet if the proxy doesn't support it,
// so we manually set a maximum of V4 in that case
- if (!proxy_supports_v5_protocol && maxProtocolVersion >= PROTOCOL_VERSION_5) {
- maxProtocolVersion = PROTOCOL_VERSION_4;
+ if (!proxy_supports_v5_protocol &&
+ ack_protocol_version >= PROTOCOL_VERSION_5) {
+ ack_protocol_version = PROTOCOL_VERSION_4;
}
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
- maxProtocolVersion,
+ ack_protocol_version,
protection,
FRAME_TYPE_CONTROL,
service_type,
@@ -266,7 +275,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
message_counters_[session_id]++));
// Cannot include a constructed payload if either side doesn't support it
- if (maxProtocolVersion >= PROTOCOL_VERSION_5) {
+ if (ack_protocol_version >= PROTOCOL_VERSION_5) {
ServiceType serviceTypeValue = ServiceTypeFromByte(service_type);
bson_object_put_int64(