forked from KNEMC/KLALB
V1.0
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user