Skip to content

Commit

Permalink
Warn when SocketTimeout option is used
Browse files Browse the repository at this point in the history
Motivation:
The SocketTimeout option has been deprecated.

Modification:
Warns when socketTimeout option is used

Result:
Fix
  • Loading branch information
jchrys committed Sep 18, 2023
1 parent 505bdd4 commit 890ea3a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/io/asyncer/r2dbc/mysql/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import io.asyncer.r2dbc.mysql.message.server.ServerMessage;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelOption;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import org.jetbrains.annotations.Nullable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand All @@ -39,6 +41,7 @@
* An abstraction that wraps the networking part of exchanging methods.
*/
public interface Client {
InternalLogger logger = InternalLoggerFactory.getInstance(Client.class);

/**
* Perform an exchange of a request message. Calling this method while a previous exchange is active will
Expand Down Expand Up @@ -133,8 +136,7 @@ static Mono<Client> connect(MySqlSslConfiguration ssl, SocketAddress address, bo
}

if (socketTimeout != null) {
tcpClient = tcpClient.option(ChannelOption.SO_TIMEOUT,
Math.toIntExact(socketTimeout.toMillis()));
logger.warn("Socket timeout is not supported by the underlying connection and will be ignored.");
}

if (address instanceof InetSocketAddress) {
Expand Down

0 comments on commit 890ea3a

Please sign in to comment.