This commit is contained in:
Administrator
2022-12-27 17:38:49 +08:00
parent 6dd349e722
commit c791720f95
18 changed files with 292 additions and 67 deletions
@@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
import org.kne.cloud.network.mport.IPPort;
@@ -21,7 +22,7 @@ import org.kne.cloud.network.mport.ThreadTool;
public class KLALBServer {
WeakHashMap<UUID, IOThreadManager> whm=new WeakHashMap<>();
Map<UUID, IOThreadManager> whm=new WeakHashMap<UUID, IOThreadManager>();
public KLALBServer(int port,Supplier<String> gjso) throws IOException {
TCPListener tcpl=new TCPListener(port);
tcpl.setCon((s)->{
@@ -30,10 +31,7 @@ public class KLALBServer {
//s.setSoTimeout(10000);
tcc=new RemoteTCPConnection(null,s);
DataInputStream din=tcc.getDin();
int val=din.readShort()&0xffff;
if(val!=59649) {
return;
}
int x=din.read();
if(x==0) {
String sj=gjso.get();
@@ -49,6 +47,7 @@ public class KLALBServer {
tcc.setTunnel(tll);
UUID uid=new UUID(din.readLong(),din.readLong());
System.out.println(uid);
IOThreadManager nx = null;
synchronized (tcpl) {
if(whm.containsKey(uid)) {
@@ -64,7 +63,7 @@ public class KLALBServer {
try {
n1.handleLocal(ltc, false);
}finally {
n1.close();
ltc.close();
}
}).start();
return true;