forked from KNEMC/KLALB
增加流量控制
增加自动按延迟选择线路
This commit is contained in:
@@ -16,6 +16,7 @@ import java.util.WeakHashMap;
|
||||
|
||||
import org.kne.cloud.network.mport.IPPort;
|
||||
import org.kne.cloud.network.mport.ServiceElement;
|
||||
import org.kne.cloud.network.mport.ThreadTool;
|
||||
|
||||
public class KLALBServer {
|
||||
|
||||
@@ -66,9 +67,30 @@ public class KLALBServer {
|
||||
nx=whm.get(uid);
|
||||
}else {
|
||||
nx=new IOThreadManager();
|
||||
IOThreadManager n1=nx;
|
||||
nx.getCore().setAcceptSYN((b)->{
|
||||
try {
|
||||
Socket soc=new Socket(b.lipport.getIp(),b.lipport.getPort());
|
||||
LocalTCPConnection ltc=new LocalTCPConnection(soc, b.cuid);
|
||||
ThreadTool.makeVThreadIfSupport("局域网连接监视线程", ()->{
|
||||
try {
|
||||
n1.handleLocal(ltc, false);
|
||||
}finally {
|
||||
n1.close();
|
||||
}
|
||||
}).start();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
System.out.println("连接本地服务"+b.lipport+"失败,请检查你的本地服务");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
whm.put(uid, nx);
|
||||
}
|
||||
}
|
||||
tcc.getDout().write(0);
|
||||
tcc.getDout().flush();
|
||||
nx.handleRemote(tcc);
|
||||
}catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user