Index: trunk/FACT++/src/DimState.h
===================================================================
--- trunk/FACT++/src/DimState.h	(revision 14350)
+++ trunk/FACT++/src/DimState.h	(revision 14351)
@@ -22,5 +22,5 @@
 
 protected:
-    typedef std::function<void(const EventImp &)> callback;
+    typedef std::function<int(const EventImp &)> callback;
 
     callback fCallback;
@@ -36,14 +36,13 @@
     }
 
-    void Callback(const EventImp &evt)
-    {
-        if (fCallback)
-            fCallback(evt);
-    }
-
-    virtual void Handler(const EventImp &evt)
+    int Callback(const EventImp &evt)
+    {
+        return fCallback ? fCallback(evt) : StateMachineImp::kSM_KeepState;
+    }
+
+    virtual int Handler(const EventImp &evt)
     {
         HandlerImp(evt);
-        Callback(evt);
+        return Callback(evt);
     }
 
@@ -145,5 +144,5 @@
     }
 
-    void HandleDesc(const EventImp &evt)
+    int HandleDesc(const EventImp &evt)
     {
         if (evt.GetSize()>0)
@@ -154,4 +153,6 @@
             CallbackStates();
         }
+
+        return StateMachineImp::kSM_KeepState;
     }
 
@@ -200,5 +201,5 @@
 
 
-    void HandleServiceDesc(const EventImp &evt)
+    int HandleServiceDesc(const EventImp &evt)
     {
         descriptions.clear();
@@ -212,4 +213,6 @@
 
         CallbackDescriptions();
+
+        return StateMachineImp::kSM_KeepState;
     }
 };
@@ -217,5 +220,5 @@
 class DimVersion : public DimState
 {
-    void Handler(const EventImp &evt)
+    int Handler(const EventImp &evt)
     {
         HandlerImp(evt);
@@ -225,5 +228,5 @@
             cur.second=kOffline;
 
-        Callback(evt);
+        return Callback(evt);
     }
 
@@ -251,5 +254,5 @@
     std::map<std::string, callback> fCallbacks;
 
-    void Handler(const EventImp &evt)
+    int Handler(const EventImp &evt)
     {
         HandlerImp(evt);
@@ -262,5 +265,5 @@
         const size_t p0 = msg.find_first_of(':');
         if (p0==std::string::npos)
-            return;
+            return StateMachineImp::kSM_KeepState;
 
         // Evaluate scriptdepth
@@ -272,5 +275,5 @@
         const size_t p1 = msg.find_last_of('[');
         if (p1==std::string::npos)
-            return;
+            return StateMachineImp::kSM_KeepState;
 
         const size_t p2 = msg.find_first_of(':', p0+1);
@@ -282,12 +285,12 @@
         shortmsg.erase(p0, p3-p0);
 
-        Callback(evt);
+        const int rc = Callback(evt);
 
         const auto func = fCallbacks.find(file);
         if (func==fCallbacks.end())
-            return;
+            return rc;
 
         // Call callback
-        func->second(evt);
+        return func->second(evt);
     }
 
@@ -340,8 +343,10 @@
             fCallbackServerEvent(evt);
     }
-    virtual void HandlerServer(const EventImp &evt)
+    virtual int HandlerServer(const EventImp &evt)
     {
         HandlerServerImp(evt);
         CallbackServerEvent(evt);
+
+        return StateMachineImp::kSM_KeepState;
     }
 
@@ -424,8 +429,10 @@
     }
 */
-    virtual void HandlerServiceList(const EventImp &evt)
+    virtual int HandlerServiceList(const EventImp &evt)
     {
         HandlerServiceListImp(evt);
         //CallbackServiceEvent(evt);
+
+        return StateMachineImp::kSM_KeepState;
     }
 
Index: trunk/FACT++/src/RemoteControl.h
===================================================================
--- trunk/FACT++/src/RemoteControl.h	(revision 14350)
+++ trunk/FACT++/src/RemoteControl.h	(revision 14351)
@@ -249,5 +249,5 @@
     }
 
-    void Handle(const EventImp &evt, const string &service)
+    int Handle(const EventImp &evt, const string &service)
     {
         const lock_guard<mutex> lock(fMutex);
@@ -261,4 +261,6 @@
             it->second.second = static_cast<Event>(evt);
         }
+
+        return StateMachineImp::kSM_KeepState;
     }
 
Index: trunk/FACT++/src/StateMachineImp.h
===================================================================
--- trunk/FACT++/src/StateMachineImp.h	(revision 14350)
+++ trunk/FACT++/src/StateMachineImp.h	(revision 14351)
@@ -21,4 +21,5 @@
     enum DefaultStates_t
     {
+        kSM_KeepState    =    -42,  ///< 
         kSM_NotReady   =     -1,  ///< Mainloop not running, state machine stopped
         kSM_Ready      =      0,  ///< Mainloop running, state machine in operation
@@ -68,8 +69,8 @@
     virtual void UnLock() { }
 
-    int Wrapper(const std::function<void(const EventImp &)> &f, const EventImp &imp)
+    int Wrapper(const std::function<int(const EventImp &)> &f, const EventImp &imp)
     {
-        f(imp);
-        return GetCurrentState();
+        const int rc = f(imp);
+        return rc==kSM_KeepState ? GetCurrentState() : rc;
     }
 
@@ -94,5 +95,5 @@
     ~StateMachineImp();
 
-    std::function<int(const EventImp &)> Wrap(const std::function<void(const EventImp &)> &func)
+    std::function<int(const EventImp &)> Wrap(const std::function<int(const EventImp &)> &func)
     {
         return bind(&StateMachineImp::Wrapper, this, func, std::placeholders::_1);
