Bug fix: Fixed broken data generation logic in AsyncRandomHandler (affects test code only)
This commit is contained in:
parent
285674e4ff
commit
7146a36f87
|
@ -197,13 +197,13 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler {
|
|||
final byte b = RANGE[(int) (Math.random() * RANGE.length)];
|
||||
buffer.put(b);
|
||||
}
|
||||
remaining -= chunk;
|
||||
|
||||
buffer.flip();
|
||||
final int bytesWritten = channel.write(buffer);
|
||||
if (bytesWritten > 0) {
|
||||
remaining -= bytesWritten;
|
||||
}
|
||||
channel.write(buffer);
|
||||
buffer.compact();
|
||||
if (remaining <= 0) {
|
||||
|
||||
if (remaining <= 0 && buffer.position() == 0) {
|
||||
channel.endStream();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue