提高性能
This commit is contained in:
@@ -11,6 +11,11 @@ import java.net.UnknownHostException;
|
||||
|
||||
public class TCPConnection {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TCPConnection [tunnel=" + tunnel + ", connect=" + connect + ", delay=" + delay + "]";
|
||||
}
|
||||
|
||||
private Tunnel tunnel;
|
||||
private Socket connect;
|
||||
private DataInputStream din;
|
||||
@@ -70,13 +75,13 @@ public class TCPConnection {
|
||||
if(tunnel!=null) {
|
||||
tunnel.setDelay(delay);
|
||||
}
|
||||
/*if(connect!=null) {
|
||||
if(connect!=null) {
|
||||
try {
|
||||
connect.setSoTimeout((int) (delay/100000));
|
||||
connect.setSoTimeout(10000);
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public void setTunnel(Tunnel tunnel) {
|
||||
@@ -92,9 +97,8 @@ public class TCPConnection {
|
||||
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));
|
||||
din = new DataInputStream(connect.getInputStream());
|
||||
dout = new DataOutputStream(connect.getOutputStream());
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
@@ -115,6 +119,11 @@ public class TCPConnection {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private volatile long RTT=10000000;
|
||||
public void nextRTT(long NRTT) {
|
||||
RTT=(long) ((1.0-Consts.A)*RTT+Consts.A*NRTT);
|
||||
System.out.println(RTT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user