]> granicus.if.org Git - icinga2/commitdiff
compatido: cleanup idosocket build, works now with conninfo db hello handshake, still...
authorMichael Friedrich <michael.friedrich@gmail.com>
Sat, 15 Sep 2012 12:59:55 +0000 (14:59 +0200)
committerMichael Friedrich <michael.friedrich@gmail.com>
Sat, 15 Sep 2012 12:59:55 +0000 (14:59 +0200)
components/compatido/Makefile.am
components/compatido/idosocket.cpp

index 9ef73381163805af770bfe85edf9f529eed35914..becebf3d0b8687a769680fb35c829b5c07a30261 100644 (file)
@@ -4,9 +4,11 @@ pkglib_LTLIBRARIES = \
        compatido.la
 
 compatido_la_SOURCES = \
+       i2-compatido.h \
+       idosocket.cpp \
+       idosocket.h \
        compatidocomponent.cpp \
-       compatidocomponent.h \
-       i2-compatido.h
+       compatidocomponent.h
 
 compatido_la_CPPFLAGS = \
         $(BOOST_CPPFLAGS) \
index 3fc34207e5f2a4435f0c1ccb0614fc6f1a4dac6a..3a962322446e439c8fa09e0dcc34973ee2e9f11a 100644 (file)
@@ -50,7 +50,7 @@ void IdoSocket::SendMessage(const String& message)
         * as we inherit all the functionality
         * of the tcpclient class
         */
-       Write(message, message.size());
+       Write(message.CStr(), message.GetLength());
 }
 
 /**
@@ -59,23 +59,23 @@ void IdoSocket::SendMessage(const String& message)
  */
 void IdoSocket::DataAvailableHandler(void)
 {
-       for (;;) {
-               string sString;
+       String sString;
 
-               {
-                       mutex::scoped_lock lock(GetMutex());
+        while (NetString::ReadStringFromIOQueue(this, &sString)) {
+                //std::cerr << "<< " << jsonString << std::endl;
 
-                       if (!Netstring::ReadStringFromFIFO(GetRecvQueue(), &sString))
-                               return;
-               }
+                try {  
+//                        Value value = Value::Deserialize(jsonString);
+
+//                        if (!value.IsObjectType<Dictionary>())
+//                                throw_exception(invalid_argument("JSON-RPC message must be a dictionary."));
+
+//                        OnNewMessage(GetSelf(), MessagePart(value));
+                } catch (const exception& ex) {
+                        Logger::Write(LogCritical, "jsonrpc", "Exception while processing message from JSON-RPC client: " + String(ex.what()));
+                }
+        }
 
-               try {
-                       //message = MessagePart(jsonString);
-                       //OnNewMessage(GetSelf(), message);
-               } catch (const exception& ex) {
-                       Logger::Write(LogCritical, "idosocket", "Exception while processing message from idosocket client: " + string(ex.what()));
-               }
-       }
 }
 
 /**