Skip to content

Commit 07cc958

Browse files
authored
Merge pull request #695 from openziti/async-sock-handle-eof
AsyncSocketImpl: properly handle EOF(-1)
2 parents 2fdb344 + 16efe80 commit 07cc958

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ziti/src/main/kotlin/org/openziti/net/nio/AsyncSocketImpl.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ internal class AsyncSocketImpl(private val connector: Connector = DefaultConnect
165165
runBlocking { readSuspend(input, to, TimeUnit.MILLISECONDS) }
166166
}
167167
input.flip()
168-
readCount.onSuccess { input.get(b, off, it) }
168+
readCount.onSuccess { c ->
169+
if (c > 0) {
170+
input.get(b, off, c)
171+
}
172+
}
169173
inputLock.release()
170174
return readCount.getOrElse { throwIOException(it) }
171175
}

0 commit comments

Comments
 (0)