Skip to content

Commit

Permalink
server buf size
Browse files Browse the repository at this point in the history
  • Loading branch information
Immueggpain authored and Immueggpain committed Jan 9, 2020
1 parent df37e5b commit 3926061
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
public class Launcher implements Callable<Void> {

public static final String VERSTR = "2.0.3";
public static final int SO_BUF_SIZE = 1024 * 1024 * 4;

public static void main(String[] args) {
int exitCode = new CommandLine(new Launcher()).setCaseInsensitiveEnumValuesAllowed(true).execute(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,16 @@ public Void call() throws Exception {
ss.setEnabledProtocols(new String[] { "TLSv1.2" });
ss.setEnabledCipherSuites(new String[] { "TLS_RSA_WITH_AES_128_GCM_SHA256" });
ss.setPerformancePreferences(0, 0, 1);
if (rcvbuf_size > 0)
ss.setReceiveBufferSize(rcvbuf_size);

ss.bind(new InetSocketAddress(server_port));

while (true) {
SSLSocket sclient_s = (SSLSocket) ss.accept();
sclient_s.setTcpNoDelay(true);
// sclient_s.setSendBufferSize(Launcher.SO_BUF_SIZE);
if (sndbuf_size > 0)
sclient_s.setSendBufferSize(sndbuf_size);
scmt.execAsync("multi-thread-handle-conn", () -> handleConnection(sclient_s));
}
}
Expand Down Expand Up @@ -273,6 +276,9 @@ private void handleConnection(Socket sclient_s) {
// create cdest(client to destination) socket
Socket cdest_s = new Socket();
cdest_s.setTcpNoDelay(true);
// server to dest use auto buf size
// cdest_s.setSendBufferSize(0);
// cdest_s.setReceiveBufferSize(0);

// connect cdest
try {
Expand Down

0 comments on commit 3926061

Please sign in to comment.