forked from KNEMC/KLALB
修复线程不能正确关闭的问题
This commit is contained in:
@@ -40,9 +40,9 @@ public class KLALBClient {
|
||||
try {
|
||||
tcc = new LocalTCPConnection(s);
|
||||
tcc.setServiceElement(sel);
|
||||
System.out.println("TCP:"+tcc.getCuid()+"已连接");
|
||||
//System.out.println("TCP:"+tcc.getCuid()+"已连接");
|
||||
iom.handleLocal(tcc,true);
|
||||
System.out.println("TCP:"+tcc.getCuid()+"已关闭");
|
||||
//System.out.println("TCP:"+tcc.getCuid()+"已关闭");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
@@ -55,9 +55,11 @@ public class KLALBClient {
|
||||
for (int i = 0; i < tls.size(); i++) {
|
||||
Tunnel tll=tls.get(i);
|
||||
ThreadTool.makeVThreadIfSupport("隧道监视线程", ()->{
|
||||
int re=0;
|
||||
RemoteTCPConnection tc=null;
|
||||
while(iom.isOpen()) {
|
||||
try {
|
||||
re++;
|
||||
tc=new RemoteTCPConnection(tll);
|
||||
tc.getDout().writeShort(59649);
|
||||
tc.getDout().write(1);
|
||||
@@ -71,6 +73,7 @@ public class KLALBClient {
|
||||
if(v==-1) {
|
||||
throw new EOFException();
|
||||
}
|
||||
re=0;
|
||||
System.out.println(tll+":连接成功");
|
||||
iom.handleRemote(tc);
|
||||
System.out.println(tll+":连接断开");
|
||||
@@ -85,7 +88,8 @@ public class KLALBClient {
|
||||
tc.close();
|
||||
}
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
//System.out.println(re);
|
||||
Thread.sleep(500*(1<<Math.min(re,8)));
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user