jnr / jnr-unixsocket

UNIX domain sockets (AF_UNIX) for Java
Apache License 2.0
278 stars 75 forks source link

Gather writes are broken #69

Closed sbordet closed 4 years ago

sbordet commented 5 years ago

The implementation of Common.write(ByteBuffer[] srcs, int offset, int length) is faulty in case the channel is set in non-blocking mode.

When in non-blocking mode, there is no guarantee that the write() actually writes any byte, so the loop over the buffers must exit as soon as the write is incomplete.

sbordet commented 5 years ago

See PR #70.

sbordet commented 5 years ago

Also, PR #40 had similar changes, part of which have been included, but not those for gather writes.

I guess #40 can be closed in favor of #70?