]> git.tdb.fi Git - libs/core.git/commitdiff
Interpret POLLHUP as end-of-file
authorMikko Rasa <tdb@tdb.fi>
Tue, 15 Oct 2013 11:51:52 +0000 (14:51 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 15 Oct 2013 11:51:52 +0000 (14:51 +0300)
source/io/eventobject.cpp
source/io/poll.h
source/io/unix/poll.cpp

index d61543c4161dd962593495c70608c58d109eb4ed..462e8bbd263ee0b962fdeac9176527fed9a87218 100644 (file)
@@ -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);
 }
index 09e00e5bbedb6313bea0832d09eb0e451a5ffe3d..952ea896068aff1c0da8bbcf2d14841a5364d3b2 100644 (file)
@@ -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)
index 650f2268e0fd2e419c7624ce76ab8890b6e952a0..6272b4dbf143e26aba3331117e284d1b690dbac7 100644 (file)
@@ -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;
 }