Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 6d62fa8..3453d18 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -22,3 +22,5 @@ #include <assert.h> +#include <errno.h> #include <unistd.h> +#include <string.h> #include <sys/types.h> @@ -133,3 +135,14 @@ bool Wellenreiter::hasMessage() int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); - return FD_ISSET( daemon_fd, &rfds ); + + if ( result == 0 ) + { + return false; + } + else if ( result == -1 ) + { + qDebug( "selected returned: %s", strerror( errno ) ); + return false; + } + else + return true; //FD_ISSET( daemon_fd, &rfds ); gibbet 'eh nur einen Deskriptor } @@ -139,8 +152,5 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) qDebug( "checking for message..." ); - - int result = hasMessage(); - qDebug( "hasMessage() returned %d", result ); - - if ( result ) + if ( hasMessage() ) { + qDebug( "got message" ); handleMessage(); @@ -149,3 +159,3 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) { - qDebug( "no message :(" ); + qDebug( "no message..." ); } |