Nate,
The result you are seeing is unexpected. Do you have a reproducer so I can
have a look at this?
Thanks
Flavia
On Thu, Jun 18, 2020 at 9:56 AM Nate <nate(a)n4te.com> wrote:
With the code below, the expected result and what I see on Windows 10
is:
position: 10, count: 20
result: 20
On Debian 10 I see:
position: 10, count: 20
result: 16364
I believe transferFrom should never return more than the count passed to
it, so this seems like a bug? I'm happy to give more information if needed.
Note the Undertow buffer size is 16364. Also, on Debian it really did
write 16364 bytes to the output channel.
Cheers,
-Nate
int position = 10;
int count = 20;
StreamSinkChannel output = exchange.getResponseChannel();
FileChannel input = new RandomAccessFile(file, "r").getChannel();
while (count > 0) {
long result;
while (true) {
System.out.println("position: " + position + ", count: " +
count);
result = output.transferFrom(input, position, count);
System.out.println("result: " + result); // expected: <= 20
if (result!= 0L) break;
try {
output.awaitWritable();
} catch (InterruptedIOException ignored) {
}
}
count -= result;
position += result;
}
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev
--
Flavia Rainone
Principal Software Engineer
Red Hat <
https://www.redhat.com>
frainone(a)redhat.com
<
https://www.redhat.com>