UI改进
This commit is contained in:
@@ -61,7 +61,7 @@ public class StreamChannelKLALBPacketLink extends AbstractKLALBPacketLink implem
|
||||
}
|
||||
|
||||
private SocketChannel connectSocket;
|
||||
private int sotimeout;
|
||||
private int sotimeout=getDefaultSoTimeout();
|
||||
public StreamChannelKLALBPacketLink(SocketChannel connectSocket) throws IOException {
|
||||
this.connectSocket=connectSocket;
|
||||
connectSocket.setOption(StandardSocketOptions.TCP_NODELAY,true);
|
||||
@@ -140,10 +140,15 @@ public class StreamChannelKLALBPacketLink extends AbstractKLALBPacketLink implem
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private ByteBuffer[] bbfwx=new ByteBuffer[100<<1];
|
||||
{
|
||||
for(int i=0;i<100;i++) {
|
||||
bbfwx[i<<1]=NetworkPacket.bufferAllocator.allocate(4);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void writePackets(ByteBuffer[] kpp,int off,int len) throws IOException {
|
||||
if(len>100) {
|
||||
ByteBuffer[] bbfw=new ByteBuffer[len<<1];
|
||||
for(int i=0;i<len;i++) {
|
||||
ByteBuffer szeWrite=NetworkPacket.bufferAllocator.allocate(4);
|
||||
@@ -153,22 +158,33 @@ public class StreamChannelKLALBPacketLink extends AbstractKLALBPacketLink implem
|
||||
szeWrite.putInt(kpp[off+i].limit());
|
||||
szeWrite.flip();
|
||||
KLALBVirtualSocketChannel obj = null;
|
||||
bbfw[i*2]=szeWrite;
|
||||
bbfw[i*2+1]=kpp[i];
|
||||
bbfw[i<<1]=szeWrite;
|
||||
bbfw[(i<<1)+1]=kpp[off+i];
|
||||
}
|
||||
connectSocket.write(bbfw);
|
||||
}else {
|
||||
for(int i=0;i<len;i++) {
|
||||
bbfwx[i<<1].clear();
|
||||
bbfwx[i<<1].limit(4);
|
||||
incOutput(kpp[off+i].limit());
|
||||
bbfwx[i<<1].putInt(kpp[off+i].limit());
|
||||
bbfwx[i<<1].flip();
|
||||
bbfwx[(i<<1)+1]=kpp[off+i];
|
||||
}
|
||||
connectSocket.write(bbfwx,0,len<<1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private ByteBuffer szeRead=NetworkPacket.bufferAllocator.allocate(4);
|
||||
|
||||
@Override
|
||||
public ByteBuffer readPacket() throws IOException {
|
||||
timeoutTimer=System.nanoTime();
|
||||
timerenabled=true;
|
||||
ByteBuffer kp;
|
||||
|
||||
ByteBuffer szeRead=NetworkPacket.bufferAllocator.allocate(4);
|
||||
szeRead.clear();
|
||||
szeRead.limit(4);
|
||||
//szeRead.clear();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user