From: Mikko Rasa Date: Tue, 15 Oct 2013 11:51:52 +0000 (+0300) Subject: Interpret POLLHUP as end-of-file X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=754132d5541ff9db869ef22e7863097110545339;p=libs%2Fcore.git Interpret POLLHUP as end-of-file --- 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; }