Skip to content

Commit

Permalink
helidon-io#7983 Re-enable TCP auto-tuning (helidon-io#7989)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkec authored Nov 10, 2023
1 parent 31afdb4 commit 4952b40
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.net.StandardSocketOptions;
import java.time.Duration;
import java.util.Map;
import java.util.Optional;

import io.helidon.builder.api.Option;
import io.helidon.builder.api.Prototype;
Expand Down Expand Up @@ -67,17 +68,17 @@ interface SocketOptionsBlueprint {
* @return buffer size, in bytes
* @see java.net.StandardSocketOptions#SO_RCVBUF
*/
@ConfiguredOption("32768")
int socketReceiveBufferSize();
@ConfiguredOption
Optional<Integer> socketReceiveBufferSize();

/**
* Socket send buffer size.
*
* @return buffer size, in bytes
* @see java.net.StandardSocketOptions#SO_SNDBUF
*/
@ConfiguredOption("32768")
int socketSendBufferSize();
@ConfiguredOption
Optional<Integer> socketSendBufferSize();

/**
* Socket reuse address.
Expand Down Expand Up @@ -129,8 +130,8 @@ default void configureSocket(Socket socket) {
class BuilderDecorator implements Prototype.BuilderDecorator<SocketOptions.BuilderBase<?, ?>> {
@Override
public void decorate(SocketOptions.BuilderBase<?, ?> target) {
target.putSocketOption(StandardSocketOptions.SO_RCVBUF, target.socketReceiveBufferSize());
target.putSocketOption(StandardSocketOptions.SO_SNDBUF, target.socketSendBufferSize());
target.socketReceiveBufferSize().ifPresent(i -> target.putSocketOption(StandardSocketOptions.SO_RCVBUF, i));
target.socketSendBufferSize().ifPresent(i -> target.putSocketOption(StandardSocketOptions.SO_SNDBUF, i));
target.putSocketOption(StandardSocketOptions.SO_REUSEADDR, target.socketReuseAddress());
target.putSocketOption(StandardSocketOptions.SO_KEEPALIVE, target.socketKeepAlive());
target.putSocketOption(StandardSocketOptions.TCP_NODELAY, target.tcpNoDelay());
Expand Down

0 comments on commit 4952b40

Please sign in to comment.