From 1e5f510d4882bf9c641e817b6b3745ec1653a795 Mon Sep 17 00:00:00 2001 From: diego Dupin Date: Wed, 7 Sep 2022 14:41:22 +0200 Subject: [PATCH] [misc] socket flushing correction --- .../mariadb/jdbc/client/socket/impl/CompressOutputStream.java | 1 + .../java/org/mariadb/jdbc/client/socket/impl/PacketWriter.java | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/mariadb/jdbc/client/socket/impl/CompressOutputStream.java b/src/main/java/org/mariadb/jdbc/client/socket/impl/CompressOutputStream.java index f3225e87f..03e77e345 100644 --- a/src/main/java/org/mariadb/jdbc/client/socket/impl/CompressOutputStream.java +++ b/src/main/java/org/mariadb/jdbc/client/socket/impl/CompressOutputStream.java @@ -131,6 +131,7 @@ public void write(byte[] b, int off, int len) throws IOException { out.write(header, 0, 7); out.write(compressedBytes, 0, compressLen); + out.flush(); } } } diff --git a/src/main/java/org/mariadb/jdbc/client/socket/impl/PacketWriter.java b/src/main/java/org/mariadb/jdbc/client/socket/impl/PacketWriter.java index a7bc15b84..e34fa8be4 100644 --- a/src/main/java/org/mariadb/jdbc/client/socket/impl/PacketWriter.java +++ b/src/main/java/org/mariadb/jdbc/client/socket/impl/PacketWriter.java @@ -832,8 +832,7 @@ protected void writeSocket(boolean commandEnd) throws IOException { buf[3] = this.sequence.incrementAndGet(); checkMaxAllowedLength(pos - 4); out.write(buf, 0, pos); - out.flush(); - + if (commandEnd) out.flush(); cmdLength += pos - 4; if (logger.isTraceEnabled()) {