tunnel: download hash list in chunks if necessary
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
94ecb13d2f
commit
6acc1125b8
@ -94,7 +94,11 @@ public class ModuleLoader {
|
|||||||
final byte[] input = new byte[1024 * 1024 * 3 /* 3MiB */];
|
final byte[] input = new byte[1024 * 1024 * 3 /* 3MiB */];
|
||||||
int len;
|
int len;
|
||||||
try (final InputStream inputStream = connection.getInputStream()) {
|
try (final InputStream inputStream = connection.getInputStream()) {
|
||||||
len = inputStream.read(input);
|
int offset = 0;
|
||||||
|
while (input.length - offset > 0 && (len = inputStream.read(input, offset, input.length - offset)) > 0) {
|
||||||
|
offset += len;
|
||||||
|
}
|
||||||
|
len = offset;
|
||||||
}
|
}
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
throw new IOException("Hash list was empty");
|
throw new IOException("Hash list was empty");
|
||||||
|
Loading…
Reference in New Issue
Block a user