removed some useless spaces; not very important, I know :)
[senf.git] / PPI / IOEvent.cc
index 2010b6b..c39d57a 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
-// Copyright (C) 2007 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -27,6 +27,7 @@
 //#include "IOEvent.ih"
 
 // Custom includes
+#include "../Utils/senfassert.hh"
 #include <boost/bind.hpp>
 
 //#include "IOEvent.mpp"
@@ -41,7 +42,7 @@
 
 prefix_ void senf::ppi::IOEvent::v_enable()
 {
-    Scheduler::instance().add(fd_, boost::bind(&IOEvent::cb,this,_1,_2), 
+    Scheduler::instance().add(fd_, boost::bind(&IOEvent::cb,this,_1),
                               Scheduler::EventId(events_));
 }
 
@@ -50,10 +51,20 @@ prefix_ void senf::ppi::IOEvent::v_disable()
     Scheduler::instance().remove(fd_, Scheduler::EventId(events_));
 }
 
-prefix_ void senf::ppi::IOEvent::cb(int, Scheduler::EventId event)
+prefix_ void senf::ppi::IOEvent::cb(Scheduler::EventId event)
 {
-    IOEventInfo info = { event };
-    callback(info);
+    if ((event & ~events_) != 0) {
+        if (event & Err)
+            throw ErrorException();
+        else if (event & Hup)
+            throw HangupException();
+        else
+            // This cannot happen.
+            SENF_ASSERT(false);
+    } else {
+        IOEventInfo info = { event };
+        callback(info);
+    }
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////