From bcfe2e278ae512db11682ac28ae60b5b9e1661c7 Mon Sep 17 00:00:00 2001 From: DieGurke <55625494+DieGurke@users.noreply.github.com> Date: Mon, 27 Jan 2020 18:36:13 +0100 Subject: [PATCH] Fixes error multiple login, removed src/test/resources Fixes #12 --- .classpath | 77 +++++++++---------- pom.xml | 5 ++ .../envoy/server/net/ObjectMessageReader.java | 9 ++- 3 files changed, 49 insertions(+), 42 deletions(-) diff --git a/.classpath b/.classpath index b468bc4..37e1a73 100644 --- a/.classpath +++ b/.classpath @@ -1,39 +1,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 047f246..39582f6 100644 --- a/pom.xml +++ b/pom.xml @@ -50,5 +50,10 @@ envoy-server-standalone + + + src/main/resources + + \ No newline at end of file diff --git a/src/main/java/envoy/server/net/ObjectMessageReader.java b/src/main/java/envoy/server/net/ObjectMessageReader.java index 51fa3df..1206cd6 100644 --- a/src/main/java/envoy/server/net/ObjectMessageReader.java +++ b/src/main/java/envoy/server/net/ObjectMessageReader.java @@ -5,7 +5,10 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -import com.jenkov.nioserver.*; +import com.jenkov.nioserver.IMessageReader; +import com.jenkov.nioserver.Message; +import com.jenkov.nioserver.MessageBuffer; +import com.jenkov.nioserver.Socket; import envoy.util.SerializationUtils; @@ -47,10 +50,10 @@ public class ObjectMessageReader implements IMessageReader { nextMessage.writeToMessage(buffer); // Get message length - if (nextMessage.length - nextMessage.offset < 4) return; + if (nextMessage.length < 4) return; int length = SerializationUtils.bytesToInt(nextMessage.sharedArray, nextMessage.offset) + 4; - if (nextMessage.length - nextMessage.offset >= length) { + if (nextMessage.length >= length) { Message message = messageBuffer.getMessage(); message.writePartialMessageToMessage(nextMessage, nextMessage.offset + length); completeMessages.add(nextMessage);