mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-08 16:32:07 +01:00
Fix buffer not being emptied
This commit is contained in:
parent
1b708bc851
commit
5b8b9cab57
@ -124,12 +124,15 @@ public final class BinaryBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeChannel(WritableByteChannel channel) throws IOException {
|
public void writeChannel(WritableByteChannel channel) throws IOException {
|
||||||
final int count = channel.write(asByteBuffer(readerOffset, writerOffset));
|
var writeBuffer = asByteBuffer(readerOffset, writerOffset);
|
||||||
if (count == -1) {
|
while (writeBuffer.position() != writeBuffer.limit()) {
|
||||||
// EOS
|
final int count = channel.write(writeBuffer);
|
||||||
throw new IOException("Disconnected");
|
if (count == -1) {
|
||||||
|
// EOS
|
||||||
|
throw new IOException("Disconnected");
|
||||||
|
}
|
||||||
|
this.readerOffset += count;
|
||||||
}
|
}
|
||||||
this.readerOffset += count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readChannel(ReadableByteChannel channel) throws IOException {
|
public void readChannel(ReadableByteChannel channel) throws IOException {
|
||||||
|
Loading…
Reference in New Issue
Block a user