提高性能
This commit is contained in:
@@ -14,14 +14,18 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.kne.cloud.network.mport.IPPort;
|
||||
import org.kne.cloud.network.mport.ServiceElement;
|
||||
|
||||
public class KLALBServer {
|
||||
WeakHashMap<UUID, IOThreadManager> whm=new WeakHashMap<>();
|
||||
public KLALBServer(int port, Map<String,ServiceElement> services,List<Tunnel> tunnels) throws IOException {
|
||||
TCPListener tcpl=new TCPListener(port);
|
||||
tcpl.setCon((s)->{
|
||||
TCPConnection tcc=null;
|
||||
try {
|
||||
//s.setSoTimeout(10000);
|
||||
TCPConnection tcc=new TCPConnection(null,s);
|
||||
tcc=new TCPConnection(null,s);
|
||||
DataInputStream din=tcc.getDin();
|
||||
int val=din.readShort()&0xffff;
|
||||
if(val!=59649) {
|
||||
@@ -80,6 +84,7 @@ public class KLALBServer {
|
||||
}
|
||||
nx.handleSocket(tcc);
|
||||
int n=nx.getTcps().size();
|
||||
System.out.println(nx.getTcps());
|
||||
if(n<=0) {
|
||||
nx.closeLocal();
|
||||
System.out.println("连接已关闭");
|
||||
@@ -89,11 +94,8 @@ public class KLALBServer {
|
||||
}catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
s.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(tcc!=null)
|
||||
tcc.close();
|
||||
}
|
||||
});
|
||||
tcpl.open();
|
||||
|
||||
Reference in New Issue
Block a user