优化代码,性能暴涨
This commit is contained in:
@@ -4,6 +4,9 @@ import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketOption;
|
||||
import java.net.SocketOptions;
|
||||
import java.net.StandardSocketOptions;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.Map;
|
||||
@@ -148,11 +151,16 @@ public class SocketToSocketProxy extends Proxy {
|
||||
}
|
||||
|
||||
protected void runBridge(SocketBridgeFactory sbf,Socket sk, Socket sox) throws IOException {
|
||||
|
||||
sk.setTcpNoDelay(true);
|
||||
sox.setTcpNoDelay(true);
|
||||
SocketBridge sb = sbf.createBridge(sk, sox);
|
||||
sb.run();
|
||||
}
|
||||
|
||||
protected void runChannelBridge(SocketChannelBridgeFactory sbf,SocketChannel sk, SocketChannel sox) throws IOException {
|
||||
sk.setOption(StandardSocketOptions.TCP_NODELAY, true);
|
||||
sox.setOption(StandardSocketOptions.TCP_NODELAY, true);
|
||||
SocketChannelBridge sb = sbf.createBridge(sk, sox);
|
||||
sb.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user