const dbus_interface_s *iface;
const dbus_method_s *methods;
DBusMessage *result = NULL;
+ bool method_is_implemented = false;
_D("Method call handler");
if (!msg || !mh) {
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; // No message to handle
}
iface = mh->iface;
if (dbus_message_is_method_call(msg, iface->name, methods[i].member) != TRUE)
continue;
+ method_is_implemented = true;
reply = calloc(1, sizeof(struct dbus_method_reply_handle_s));
if (!reply) {
_E("calloc() failed");
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NEED_MEMORY; // Failed to create reply, try again later
}
reply->handle = mh->handle;
break;
}
+ if (!method_is_implemented)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; // Missing method, no reply
+ /* If result is null, reply will be sent by worker thread */
if (result)
- reply_dbus_method_result(reply, result);
+ reply_dbus_method_result(reply, result); // Method handled, reply sent
return DBUS_HANDLER_RESULT_HANDLED;
}