From 754132d5541ff9db869ef22e7863097110545339 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 15 Oct 2013 14:51:52 +0300 Subject: [PATCH] Interpret POLLHUP as end-of-file --- source/io/eventobject.cpp | 2 ++ source/io/poll.h | 3 ++- source/io/unix/poll.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/io/eventobject.cpp b/source/io/eventobject.cpp index d61543c..462e8bb 100644 --- a/source/io/eventobject.cpp +++ b/source/io/eventobject.cpp @@ -20,6 +20,8 @@ void EventObject::event(PollEvent ev) { if(ev&P_INPUT) signal_data_available.emit(); + if(ev&P_HANGUP) + signal_end_of_file.emit(); on_event(ev); } diff --git a/source/io/poll.h b/source/io/poll.h index 09e00e5..952ea89 100644 --- a/source/io/poll.h +++ b/source/io/poll.h @@ -17,7 +17,8 @@ enum PollEvent P_INPUT = 1, P_PRIO = 2, P_OUTPUT = 4, - P_ERROR = 8 + P_ERROR = 8, + P_HANGUP = 16 }; inline PollEvent operator|(PollEvent e, PollEvent f) diff --git a/source/io/unix/poll.cpp b/source/io/unix/poll.cpp index 650f226..6272b4d 100644 --- a/source/io/unix/poll.cpp +++ b/source/io/unix/poll.cpp @@ -43,6 +43,8 @@ inline PollEvent poll_event_from_sys(int event) result = result|P_OUTPUT; if(event&POLLERR) result = result|P_ERROR; + if(event&POLLHUP) + result = result|P_HANGUP; return result; } -- 2.45.2