再次优化调度性能
This commit is contained in:
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user