Skip to content

Commit adb70ea

Browse files
author
Robert Henigan
authored
Merge pull request #1653 from smartdevicelink/bugfix/encryption_mtu_corner_case
Fix encryption mtu corner case
2 parents 33d2fbb + b271fee commit adb70ea

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,9 @@ public void sendMessage(ProtocolMessage protocolMsg) {
615615
return;
616616
}
617617

618-
//Set the MTU according to session MTU provided by the IVI or the max data size for encryption if required
619-
final Long mtu = requiresEncryption ? TLS_MAX_DATA_TO_ENCRYPT_SIZE : getMtu(sessionType);
618+
//Set the MTU according to service MTU provided by the IVI .
619+
//If encryption is required the MTU will be set to lowest value between the max data size for encryption or service MTU
620+
final Long mtu = requiresEncryption ? Math.min(TLS_MAX_DATA_TO_ENCRYPT_SIZE, getMtu(sessionType)) : getMtu(sessionType);
620621

621622
synchronized (messageLock) {
622623
if (data != null && data.length > mtu) {

0 commit comments

Comments
 (0)