Skip to content

Commit 6c36108

Browse files
committed
[CONJ-673] Abording a connection while fetching a query won't read the whole result-set
(cherry picked from commit d7f3bda)
1 parent d4a7bd8 commit 6c36108

File tree

2 files changed

+1051
-974
lines changed

2 files changed

+1051
-974
lines changed

src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,12 @@ private static void closeSocket(PacketInputStream packetInputStream,
199199
PacketOutputStream packetOutputStream, Socket socket) {
200200
try {
201201
try {
202+
long maxCurrentMillis = System.currentTimeMillis() + 10;
202203
socket.shutdownOutput();
203204
socket.setSoTimeout(3);
204205
InputStream is = socket.getInputStream();
205206
//noinspection StatementWithEmptyBody
206-
while (is.read() != -1) {
207+
while (is.read() != -1 && System.currentTimeMillis() < maxCurrentMillis) {
207208
//read byte
208209
}
209210
} catch (Throwable t) {

0 commit comments

Comments
 (0)