- 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:
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);
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;