diff options
author | Joey Grover <joeygrover@gmail.com> | 2021-04-06 13:51:17 -0400 |
---|---|---|
committer | Joey Grover <joeygrover@gmail.com> | 2021-04-06 13:51:17 -0400 |
commit | b271feee2dd8a0ee4e0b63ee8e9a1b52452f8674 (patch) | |
tree | 7732cf701f708d2786638fffdbafdd3c8185e2be | |
parent | 33d2fbb99bf56bd363dc7177ab1b4eb5842207c9 (diff) | |
download | sdl_android-b271feee2dd8a0ee4e0b63ee8e9a1b52452f8674.tar.gz |
Take lower value for MTU if encryptedbugfix/encryption_mtu_corner_case
-rw-r--r-- | base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java index 64578e7ee..5cac1302c 100644 --- a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java +++ b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java @@ -615,8 +615,9 @@ public class SdlProtocolBase { return; } - //Set the MTU according to session MTU provided by the IVI or the max data size for encryption if required - final Long mtu = requiresEncryption ? TLS_MAX_DATA_TO_ENCRYPT_SIZE : getMtu(sessionType); + //Set the MTU according to service MTU provided by the IVI . + //If encryption is required the MTU will be set to lowest value between the max data size for encryption or service MTU + final Long mtu = requiresEncryption ? Math.min(TLS_MAX_DATA_TO_ENCRYPT_SIZE, getMtu(sessionType)) : getMtu(sessionType); synchronized (messageLock) { if (data != null && data.length > mtu) { |