KLALB V3.4

This commit is contained in:
Administrator
2025-11-15 11:08:16 +08:00
parent 306bfd36f7
commit 8842566ee2
160 changed files with 18540 additions and 4512 deletions
@@ -10,6 +10,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import org.kne.cloud.network.ByteBufferAllocator;
import org.kne.cloud.network.NetworkPacket;
import org.kne.cloud.network.klalb.KLALBPacket;
@@ -19,7 +20,7 @@ public class TESTNPacket extends KLALBPacket {
private ByteBuffer dataBuffer;//=NetworkPacket.databufferpool_65535.borrow();
@Override
public long getLength() {
public long getTotalLength() {
return HEADER_LENGTH+dataBuffer.limit();
}
@@ -27,7 +28,7 @@ public class TESTNPacket extends KLALBPacket {
public TESTNPacket(int limit) {
super(TESTN,HEADER_LENGTH);
//dataBuffer.limit(limit);
dataBuffer=ByteBuffer.allocate(limit);
dataBuffer=NetworkPacket.bufferAllocator.allocate(limit);
}
@@ -49,9 +50,7 @@ public class TESTNPacket extends KLALBPacket {
public void readFromChannel(ReadableByteChannel din) throws IOException {
super.readFromChannel(din);
int limit=klalbHeader.getChar(1);
//dataBuffer.clear();
//dataBuffer.limit(limit);
dataBuffer=ByteBuffer.allocate(limit);
dataBuffer=NetworkPacket.bufferAllocator.allocate(limit);
while(dataBuffer.hasRemaining()){
if(din.read(dataBuffer)==-1) {
throw new EOFException();