static void host_name_resolver_callback(
    AvahiSHostNameResolver *r,
    AVAHI_GCC_UNUSED AvahiIfIndex interface,
    AVAHI_GCC_UNUSED AvahiProtocol protocol,
    AvahiResolverEvent event,
    const char *host_name,
    const AvahiAddress *a,
    AvahiLookupResultFlags flags,
    void* userdata) {

    AvahiDNSServerInfo *i = userdata;

    assert(r);
    assert(host_name);
    assert(i);

    switch (event) {
        case AVAHI_RESOLVER_FOUND: {
            i->address = *a;

            i->browser->callback(
                i->browser,
                i->interface,
                i->protocol,
                AVAHI_BROWSER_NEW,
                i->srv_record->data.srv.name,
                &i->address,
                i->srv_record->data.srv.port,
                i->flags | flags,
                i->browser->userdata);

            break;
        }

        case AVAHI_RESOLVER_FAILURE:
            /* Ignore */
            break;
    }

    avahi_s_host_name_resolver_free(i->host_name_resolver);
    i->host_name_resolver = NULL;
}
static void host_name_resolver_callback(
    AvahiSHostNameResolver *r,
    AVAHI_GCC_UNUSED AvahiIfIndex interface,
    AVAHI_GCC_UNUSED AvahiProtocol protocol,
    AvahiResolverEvent event,
    const char *host_name,
    const AvahiAddress *a,
    AvahiLookupResultFlags flags,
    void* userdata) {

    AvahiDNSServerInfo *i = userdata;

    assert(r);
    assert(host_name);
    assert(i);

    switch (event) {
        case AVAHI_RESOLVER_FOUND: {
            i->address = *a;

            i->browser->callback(
                i->browser,
                i->interface,
                i->protocol,
                AVAHI_BROWSER_NEW,
                i->srv_record->data.srv.name,
                &i->address,
                i->srv_record->data.srv.port,
                i->flags | flags,
                i->browser->userdata);

            break;
        }

        case AVAHI_RESOLVER_FAILURE:
             
            break;
    }

    avahi_s_host_name_resolver_free(i->host_name_resolver);
    i->host_name_resolver = NULL;
}