Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ object EpollSystem extends PollingSystem {
private[this] var writeCallback: Either[Throwable, Int] => Unit = null

def notify(events: Int): Unit = {
if ((events & EPOLLIN) != 0) {
if ((events & EPOLLIN) != 0 || (events & EPOLLHUP) != 0) {
val counter = readReadyCounter + 1
readReadyCounter = counter
val cb = readCallback
Expand Down Expand Up @@ -269,6 +269,7 @@ object EpollSystem extends PollingSystem {
final val EPOLLOUT = 0x004
final val EPOLLONESHOT = 1 << 30
final val EPOLLET = 1 << 31
final val EPOLLHUP = 1 << 4

type epoll_event
type epoll_data_t = Ptr[Byte]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ class FileDescriptorPollerSpec extends BaseSpec {
pipe.read(new Array[Byte](1), 0, 1).as(false).timeoutTo(1.second, IO.pure(true))
}
}

"handle EPOLLHUP events" in real {
mkPipe.use { pipe =>
for {
buf <- IO(new Array[Byte](4))
_ <- pipe.write(Array[Byte](1, 2, 3), 0, 3)
_ <- pipe.read(buf, 0, 3)
_ <- IO(unistd.close(pipe.writeFd))
_ <- pipe.read(buf, 3, 1)
} yield buf.toList must be_==(List[Byte](1, 2, 3, 0))
}
}
}

}
Loading