diff --git a/vertx-mssql-client/src/main/java/io/vertx/mssqlclient/impl/codec/TdsMessageCodec.java b/vertx-mssql-client/src/main/java/io/vertx/mssqlclient/impl/codec/TdsMessageCodec.java index c6a44ae292..a25fd6dee4 100644 --- a/vertx-mssql-client/src/main/java/io/vertx/mssqlclient/impl/codec/TdsMessageCodec.java +++ b/vertx-mssql-client/src/main/java/io/vertx/mssqlclient/impl/codec/TdsMessageCodec.java @@ -14,9 +14,8 @@ import io.netty.buffer.ByteBufAllocator; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.CombinedChannelDuplexHandler; +import io.vertx.core.Completable; import io.vertx.sqlclient.ClosedConnectionException; -import io.vertx.sqlclient.internal.command.CommandBase; -import io.vertx.sqlclient.internal.command.CommandResponse; import java.util.ArrayDeque; import java.util.HashMap; @@ -66,9 +65,10 @@ private void fail(Throwable cause) { } private void fail(MSSQLCommandCodec codec, Throwable cause) { - CommandResponse failure = CommandResponse.failure(cause); - failure.cmd = (CommandBase) codec.cmd; - chctx.fireChannelRead(failure); + Completable handler = codec.cmd.handler; + if (handler != null) { + handler.complete(null, cause); + } } @Override diff --git a/vertx-mysql-client/src/main/java/io/vertx/mysqlclient/impl/codec/MySQLCodec.java b/vertx-mysql-client/src/main/java/io/vertx/mysqlclient/impl/codec/MySQLCodec.java index 480199ad58..bc1bb7c3df 100644 --- a/vertx-mysql-client/src/main/java/io/vertx/mysqlclient/impl/codec/MySQLCodec.java +++ b/vertx-mysql-client/src/main/java/io/vertx/mysqlclient/impl/codec/MySQLCodec.java @@ -18,6 +18,7 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.CombinedChannelDuplexHandler; +import io.vertx.core.Completable; import io.vertx.mysqlclient.impl.MySQLSocketConnection; import io.vertx.sqlclient.ClosedConnectionException; import io.vertx.sqlclient.internal.command.CommandBase; @@ -80,9 +81,10 @@ private void clearInflightCommands(Throwable cause) { private void fail(CommandCodec codec, Throwable cause) { if (failure == null) { failure = cause; - CommandResponse failure = CommandResponse.failure(cause); - failure.cmd = (CommandBase) codec.cmd; - chctx.fireChannelRead(failure); + Completable handler = codec.cmd.handler; + if (handler != null) { + handler.complete(null, cause); + } } }