- if (!(message = dbus_pending_call_steal_reply(pending)))
- goto fail;
-
- if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_RETURN) {
- int32_t interface;
- AvahiProtocol protocol, aprotocol;
- char *name, *address;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- assert(address);
- if (!avahi_address_parse(address, (AvahiProtocol) aprotocol, &a)) {
- fprintf(stderr, "Failed to parse address\n");
- goto fail;
- }
-
- r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, (AvahiProtocol) aprotocol, &a, name, r->userdata);
-
- } else {
-
- assert(dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR);
-
- avahi_client_set_errno(r->client, avahi_error_dbus_to_number(dbus_message_get_error_name(message)));
-
- r->callback(r, (AvahiIfIndex) 0, (AvahiProtocol) 0, AVAHI_RESOLVER_TIMEOUT, (AvahiProtocol) 0, NULL, NULL, r->userdata);
- }
-
-fail:
-
- if (message)
- dbus_message_unref(message);
-
- dbus_error_free (&error);
-}
-
-/* AvahiServiceResolver implementation */