Skip to content
Permalink
Browse files
[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 <ali.al.solaiman@gmail.com>
Tested-by: Murtadha Hubail <mhubail@apache.org>
  • Loading branch information
mhubail committed Apr 1, 2022
1 parent 2636846 commit 0afd4ee7ea0b01ac4bc2f69eb26a402166d7804a
Showing 1 changed file with 1 addition and 1 deletion.
@@ -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());

0 comments on commit 0afd4ee

Please sign in to comment.