Fixed reading multiple objects from one message
This commit is contained in:
parent
23c4fd8f67
commit
2ffcf6e1a3
@ -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;
|
||||
|
||||
@ -55,8 +58,9 @@ public class ObjectMessageReader implements IMessageReader {
|
||||
// Separate first complete message
|
||||
if (nextMessage.length >= length) {
|
||||
Message message = messageBuffer.getMessage();
|
||||
message.writePartialMessageToMessage(nextMessage, nextMessage.offset + length);
|
||||
message.length = nextMessage.length - length;
|
||||
message.writePartialMessageToMessage(nextMessage, length);
|
||||
message.length = nextMessage.length - length;
|
||||
nextMessage.length = length;
|
||||
completeMessages.add(nextMessage);
|
||||
nextMessage = message;
|
||||
}
|
||||
|
Reference in New Issue
Block a user