From 460964bd6e042a5dc72429aab98f2e61eb1958fd Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 3 Feb 2020 14:33:58 +0100 Subject: [PATCH] Fix bug in BytesArrayTools reading --- src/protocolP2P/ProtocolP2PDatagram.java | 22 +++++++++++++--------- src/tools/BytesArrayTools.java | 7 ++++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/protocolP2P/ProtocolP2PDatagram.java b/src/protocolP2P/ProtocolP2PDatagram.java index 11db2d5..079c0fd 100644 --- a/src/protocolP2P/ProtocolP2PDatagram.java +++ b/src/protocolP2P/ProtocolP2PDatagram.java @@ -243,28 +243,32 @@ public class ProtocolP2PDatagram { this.hostR = hostR; } - private int computeCheckSum(byte [] datagram){ + private int computeCheckSum(byte [] datagram) throws SizeError { int checksum = 0; - for (int i=CHECKSUM_POSITION+2; i