再次优化调度性能

This commit is contained in:
Administrator
2022-11-29 15:12:14 +08:00
parent 05d4117ef3
commit 7d90fa17bd
8 changed files with 175 additions and 82 deletions
@@ -20,11 +20,11 @@ public class TCPConnection {
}
private DataOutputStream dout;
private long delay;
private long delay=-1;
public Socket getConnect() {
/*public Socket getConnect() {
return connect;
}
}*/
public DataInputStream getDin() {
return din;
@@ -56,6 +56,8 @@ public class TCPConnection {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
if(tunnel!=null&&connect!=null)
tunnel.getCCount().decrementAndGet();
connect = null;
}
@@ -65,9 +67,12 @@ public class TCPConnection {
public void setDelay(long delay) {
this.delay = delay;
if(tunnel!=null) {
tunnel.setDelay(delay);
}
if(connect!=null) {
try {
connect.setSoTimeout((int) (delay/500000));
connect.setSoTimeout((int) (delay/100000));
} catch (SocketException e) {
e.printStackTrace();
}
@@ -84,6 +89,9 @@ public class TCPConnection {
public TCPConnection(Tunnel t, Socket soc) throws IOException {
connect = soc;
tunnel = t;
if(t!=null) {
t.getCCount().incrementAndGet();
}
// connect.setSoTimeout(10000);
din = new DataInputStream(new BufferedInputStream(connect.getInputStream(), 65536));
dout = new DataOutputStream(new BufferedOutputStream(connect.getOutputStream(), 65536));
@@ -108,4 +116,6 @@ public class TCPConnection {
}
}
}