From 450f1aa5fb5bd8349e14bc0a105cb66fa8300788 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 7 May 2020 14:51:31 +0200 Subject: [PATCH] Fixed issue with RMI registration validation fragmentation count --- .../network/connection/RegistrationWrapperClient.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dorkbox/network/connection/RegistrationWrapperClient.java b/src/dorkbox/network/connection/RegistrationWrapperClient.java index f6a2b75b..ceccff59 100644 --- a/src/dorkbox/network/connection/RegistrationWrapperClient.java +++ b/src/dorkbox/network/connection/RegistrationWrapperClient.java @@ -146,7 +146,7 @@ class RegistrationWrapperClient extends RegistrationWrapper { private static byte[][] divideArray(byte[] source, int chunksize) { - int fragments = (int) Math.ceil(source.length / ((double) chunksize + 2)); + int fragments = (int) Math.ceil(source.length / ((double) chunksize)); if (fragments > 127) { // cannot allow more than 127 return null; @@ -165,9 +165,9 @@ class RegistrationWrapperClient extends RegistrationWrapper { else { length = chunksize; } - splitArray[i] = new byte[length+2]; - splitArray[i][0] = (byte) i; - splitArray[i][1] = (byte) fragments; + splitArray[i] = new byte[length + 2]; + splitArray[i][0] = (byte) i; // index + splitArray[i][1] = (byte) fragments; // total number of fragments System.arraycopy(source, start, splitArray[i], 2, length); start += chunksize;