{
DBusWatch* activeWatch = gDbus.incomingWatch[fd];
- pthread_mutex_lock(&gDbus.mutex);
- dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_READABLE);
- pthread_mutex_unlock(&gDbus.mutex);
-
- if (!success)
+ if (activeWatch)
+ {
+ pthread_mutex_lock(&gDbus.mutex);
+ dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_READABLE);
+ pthread_mutex_unlock(&gDbus.mutex);
+
+ if (!success)
+ {
+ printf("incoming dbus_watch_handle() failed\n");
+ }
+ }
+ else
{
- printf("incoming dbus_watch_handle() failed\n");
+ printf("no watch was found for incoming fd %d, not calling dbus_watch_handle(NULL)\n", fd);
}
}
}
{
DBusWatch* activeWatch = gDbus.outgoingWatch[fd];
- pthread_mutex_lock(&gDbus.mutex);
- dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_WRITABLE);
- pthread_mutex_unlock(&gDbus.mutex);
-
- if (!success)
+ if (activeWatch)
+ {
+ pthread_mutex_lock(&gDbus.mutex);
+ dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_WRITABLE);
+ pthread_mutex_unlock(&gDbus.mutex);
+
+ if (!success)
+ {
+ printf("outgoing dbus_watch_handle() failed\n");
+ }
+ }
+ else
{
- printf("outgoing dbus_watch_handle() failed\n");
+ printf("no watch was found for outgoing fd %d, not calling dbus_watch_handle(NULL)\n", fd);
}
}
}