Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

position is not increased in AsynchronousFileChannel.sink #685

Open
somdoron opened this issue Jun 17, 2024 · 0 comments
Open

position is not increased in AsynchronousFileChannel.sink #685

somdoron opened this issue Jun 17, 2024 · 0 comments

Comments

@somdoron
Copy link

somdoron commented Jun 17, 2024

In AsynchronousFileChannel.sink, the position is not increased when sending ByteBuffer to the underlying channel:
https://github.com/zio/zio-nio/blob/series/2.x/nio/jvm/src/main/scala/zio/nio/channels/AsynchronousFileChannel.scala#L162

 ZStream
   .repeatZIOWithSchedule(
     write(buffer, currentPos),
     Schedule.recurWhileZIO(Function.const(buffer.hasRemaining))
   )
   .runSum

Between each call to write here the position must be advanced. writeChunk seems to do it correctly:
https://github.com/zio/zio-nio/blob/series/2.x/nio/jvm/src/main/scala/zio/nio/channels/AsynchronousFileChannel.scala#L86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant