From 0afd4ee7ea0b01ac4bc2f69eb26a402166d7804a Mon Sep 17 00:00:00 2001 From: Murtadha Hubail Date: Sat, 2 Apr 2022 01:05:55 +0300 Subject: [PATCH] [NO ISSUE][NET] Attempt to Read SSL Sockets Until EOF - user model changes: no - storage format changes: no - interface changes: no Details: - Since SSL sockets may return 0 as read bytes due to failure to decrypt a complete encrypted block, we need to attempt to read again until a complete block is decrypted. Change-Id: Ia48b7f9f1725c40b2ebfac6fe77b3eb42c426de3 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/15964 Reviewed-by: Ali Alsuliman Tested-by: Murtadha Hubail --- .../apache/asterix/replication/management/NetworkingUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/NetworkingUtil.java b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/NetworkingUtil.java index 8162e0af3f..b38f0aa8d3 100644 --- a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/NetworkingUtil.java +++ b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/NetworkingUtil.java @@ -49,7 +49,7 @@ public static void readBytes(ISocketChannel socketChannel, ByteBuffer byteBuffer byteBuffer.clear(); byteBuffer.limit(length); - while (byteBuffer.remaining() > 0 && socketChannel.read(byteBuffer) > 0); + while (byteBuffer.remaining() > 0 && socketChannel.read(byteBuffer) >= 0); if (byteBuffer.remaining() > 0) { throw new EOFException("could not read all data from source; remaining bytes: " + byteBuffer.remaining());