fixed manual merge from a 0.9 patch
authorKevron Rees <kevron_m_rees@linux.intel.com>
Mon, 13 May 2013 22:21:36 +0000 (15:21 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Tue, 14 May 2013 18:31:45 +0000 (11:31 -0700)
TODO
plugins/websocketsink/websocketsinkmanager.cpp
plugins/websocketsourceplugin/websocketsource.cpp

diff --git a/TODO b/TODO
index 166ce46..ea9446e 100644 (file)
--- a/TODO
+++ b/TODO
@@ -9,6 +9,7 @@ For 0.10.0
 - DBus support for objects with multiple sources and multiple 'zones' (ie /org/automotive/${sourceID}/${zone}/batteryVoltage/${index})
 - Document changes to the DBus API
 
+- investigate why websocketsink plugin constantly gets disconnected when using eth0
 
 
 Other:
index b43b856..af8e982 100644 (file)
@@ -778,20 +778,30 @@ static int websocket_callback(struct libwebsocket_context *context,struct libweb
        return 0; 
 }
 
-bool gioPollingFunc(GIOChannel *source,GIOCondition condition,gpointer data)
+bool gioPollingFunc(GIOChannel *source, GIOCondition condition,gpointer data)
 {
        DebugOut(5) << "Polling..." << condition << endl;
-       if (condition != G_IO_IN)
+
+       if(condition & G_IO_ERR)
+       {
+               DebugOut(0)<<"websocketsink polling error."<<endl;
+       }
+
+       if (! condition & G_IO_IN)
        {
                //Don't need to do anything
-               if (condition == G_IO_HUP)
-               {
-                       //Hang up. Returning false closes out the GIOChannel.
-                       //printf("Callback on G_IO_HUP\n");
-                       return false;
-               }
+
                return true;
        }
+
+       if (condition & G_IO_HUP)
+       {
+               //Hang up. Returning false closes out the GIOChannel.
+               //printf("Callback on G_IO_HUP\n");
+               DebugOut(0)<<"socket hangup event..."<<endl;
+               return false;
+       }
+
        //This is the polling function. If it return false, glib will stop polling this FD.
        //printf("Polling...%i\n",condition);
        
index 38e1887..0574314 100644 (file)
@@ -465,10 +465,15 @@ static int callback_http_only(libwebsocket_context *context,struct libwebsocket
                  DebugOut(5) << __SMALLFILE__ << ":" << __LINE__ << "Adding poll for websocket IO channel" << endl;
                        //Add a FD to the poll list.
                        GIOChannel *chan = g_io_channel_unix_new(libwebsocket_get_socket_fd(wsi));
-                       g_io_add_watch(chan,G_IO_IN,(GIOFunc)gioPollingFunc,0);
-                       g_io_add_watch(chan,G_IO_PRI,(GIOFunc)gioPollingFunc,0);
-                       g_io_add_watch(chan,G_IO_ERR,(GIOFunc)gioPollingFunc,0);
-                       g_io_add_watch(chan,G_IO_HUP,(GIOFunc)gioPollingFunc,0);
+                       /// TODO: I changed this to be more consistent with the websocket sink end. it may not be correct. TEST
+
+                       g_io_add_watch(chan,GIOCondition(G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP),(GIOFunc)gioPollingFunc,0);
+                       g_io_channel_set_close_on_unref(chan,true);
+                       g_io_channel_unref(chan); //Pass ownership of the GIOChannel to the watch.
+
+                       //g_io_add_watch(chan,G_IO_PRI,(GIOFunc)gioPollingFunc,0);
+                       //g_io_add_watch(chan,G_IO_ERR,(GIOFunc)gioPollingFunc,0);
+                       //g_io_add_watch(chan,G_IO_HUP,(GIOFunc)gioPollingFunc,0);
                        
                        
                        break;