=str #19775 FilePublisher should not report EOF multiple times

This commit is contained in:
Piotr Jarzemski 2016-02-15 10:05:36 +01:00
parent a83f08d4ab
commit d5f8186f05

View file

@ -83,7 +83,7 @@ private[akka] final class FilePublisher(f: File, completionPromise: Promise[IORe
/** BLOCKING I/O READ */
@tailrec def readAhead(maxChunks: Int, chunks: Vector[ByteString]): Vector[ByteString] =
if (chunks.size <= maxChunks && isActive) {
if (chunks.size <= maxChunks && isActive && !eofEncountered) {
(try chan.read(buf) catch { case NonFatal(ex) onErrorThenStop(ex); Int.MinValue }) match {
case -1 // EOF
eofReachedAtOffset = chan.position