From e222d33ab66e0b9cb02f6d5e0fd5357792bebf2c Mon Sep 17 00:00:00 2001 From: Artem Nosach Date: Mon, 10 Aug 2015 10:54:13 +0300 Subject: Post review fixes Implements: APPLINK-14656 --- src/components/include/protocol/common.h | 5 +++-- src/components/protocol_handler/src/protocol_handler_impl.cc | 11 +++-------- src/components/protocol_handler/src/protocol_packet.cc | 8 ++++---- 3 files changed, 10 insertions(+), 14 deletions(-) (limited to 'src/components') diff --git a/src/components/include/protocol/common.h b/src/components/include/protocol/common.h index 3f5d59df84..91bc53652c 100644 --- a/src/components/include/protocol/common.h +++ b/src/components/include/protocol/common.h @@ -196,9 +196,10 @@ enum { /** *\brief If FRAME_TYPE_CONTROL: Constant: Default maximum size of one frame - *\brief excluding frame header (used Ethernet MTU as default target transport) + *\brief excluding frame header for protocol version 2 + *\brief (used Ethernet MTU as default target transport) */ -const size_t DEFAULT_FRAME_DATA_SIZE = 1488; +const size_t MAXIMUM_FRAME_DATA_V2_SIZE = 1488; /** *\brief If FRAME_TYPE_CONSECUTIVE: Constant: Size of first frame in diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 2c7bad263d..3289c6b4d8 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -341,7 +341,6 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, return; } - if (!session_observer_) { LOG4CXX_ERROR( logger_, @@ -361,15 +360,12 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, #endif // TIME_TESTER const size_t max_frame_size = profile::Profile::instance()->maximum_payload_size(); - size_t frame_size = DEFAULT_FRAME_DATA_SIZE; + size_t frame_size = MAXIMUM_FRAME_DATA_V2_SIZE; switch (message->protocol_version()) { - case PROTOCOL_VERSION_1: - case PROTOCOL_VERSION_2: - break; case PROTOCOL_VERSION_3: case PROTOCOL_VERSION_4: - frame_size = max_frame_size > DEFAULT_FRAME_DATA_SIZE ? - max_frame_size : DEFAULT_FRAME_DATA_SIZE; + frame_size = max_frame_size > MAXIMUM_FRAME_DATA_V2_SIZE ? + max_frame_size : MAXIMUM_FRAME_DATA_V2_SIZE; break; default: break; @@ -389,7 +385,6 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, } LOG4CXX_DEBUG(logger_, "Optimal packet size is " << frame_size); #endif // ENABLE_SECURITY - DCHECK(DEFAULT_FRAME_DATA_SIZE <= frame_size); if (message->data_size() <= frame_size) { RESULT_CODE result = SendSingleFrameMessage(connection_handle, sessionID, diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc index e22d10e723..a31678ec6e 100644 --- a/src/components/protocol_handler/src/protocol_packet.cc +++ b/src/components/protocol_handler/src/protocol_packet.cc @@ -135,16 +135,16 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( const ProtocolHeader& header) const { // expected payload size will be calculated depending // on used protocol version - size_t payload_size = DEFAULT_FRAME_DATA_SIZE; - // Protocol version shall be from 1 to 3 + size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; + // Protocol version shall be from 1 to 4 switch (header.version) { case PROTOCOL_VERSION_1: case PROTOCOL_VERSION_2: break; case PROTOCOL_VERSION_3: case PROTOCOL_VERSION_4: - payload_size = max_payload_size_ > DEFAULT_FRAME_DATA_SIZE ? - max_payload_size_ : DEFAULT_FRAME_DATA_SIZE; + payload_size = max_payload_size_ > MAXIMUM_FRAME_DATA_V2_SIZE ? + max_payload_size_ : MAXIMUM_FRAME_DATA_V2_SIZE; break; default: return RESULT_FAIL; -- cgit v1.2.1