Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
acogoluegnes committed May 29, 2024
1 parent 42d0a18 commit fd4dec6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/rabbitmq/perf/PerfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1357,8 +1357,10 @@ static Options getOptions() {
false,
"Same as --verbose, but with message headers and body as well. Use only with slow rates."));

options.addOption(new Option("tsbs", "tcp-send-buffer-size", true, "value for TCP SO_SNDBUF option"));
options.addOption(new Option("trbs", "tcp-receive-buffer-size", true, "value for TCP SO_RCVBUF option"));
options.addOption(
new Option("tsbs", "tcp-send-buffer-size", true, "value for TCP SO_SNDBUF option"));
options.addOption(
new Option("trbs", "tcp-receive-buffer-size", true, "value for TCP SO_RCVBUF option"));
return options;
}

Expand Down
30 changes: 17 additions & 13 deletions src/main/java/com/rabbitmq/perf/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,21 @@ static SocketConfigurator socketConfigurator(CommandLineProxy cmd) {
SocketConfigurator socketConfigurator = SocketConfigurators.defaultConfigurator();
List<SNIServerName> serverNames = sniServerNames(strArg(cmd, "sni", null));
if (!serverNames.isEmpty()) {
socketConfigurator = socketConfigurator.andThen(socket -> {
if (socket instanceof SSLSocket) {
SSLSocket sslSocket = (SSLSocket) socket;
SSLParameters sslParameters =
sslSocket.getSSLParameters() == null
? new SSLParameters()
: sslSocket.getSSLParameters();
sslParameters.setServerNames(serverNames);
sslSocket.setSSLParameters(sslParameters);
} else {
LOGGER.warn("SNI parameter set on a non-TLS connection");
}});
socketConfigurator =
socketConfigurator.andThen(
socket -> {
if (socket instanceof SSLSocket) {
SSLSocket sslSocket = (SSLSocket) socket;
SSLParameters sslParameters =
sslSocket.getSSLParameters() == null
? new SSLParameters()
: sslSocket.getSSLParameters();
sslParameters.setServerNames(serverNames);
sslSocket.setSSLParameters(sslParameters);
} else {
LOGGER.warn("SNI parameter set on a non-TLS connection");
}
});
}
int sendBufferSize = intArg(cmd, "tsbs", -1);
int receiveBufferSize = intArg(cmd, "trbs", -1);
Expand All @@ -172,7 +175,8 @@ static SocketConfigurator socketConfigurator(CommandLineProxy cmd) {
static SocketChannelConfigurator socketChannelConfigurator(CommandLineProxy cmd) {
int sendBufferSize = intArg(cmd, "tsbs", -1);
int receiveBufferSize = intArg(cmd, "trbs", -1);
return SocketChannelConfigurators.defaultConfigurator().andThen(
return SocketChannelConfigurators.defaultConfigurator()
.andThen(
socketChannel -> {
if (sendBufferSize > 0) {
socketChannel.socket().setSendBufferSize(sendBufferSize);
Expand Down

0 comments on commit fd4dec6

Please sign in to comment.