On Thu, 20.02.14 21:11, Daniel Buch (boogiewasth...@gmail.com) wrote:

>  
>                  log_debug("Looking up address info for %s:%s", node, 
> service);
> -                r = getaddrinfo(node, service, &hints, &result);
> -                if (r != 0) {
> +                r = sd_resolve_getaddrinfo(resolve, &q, node, service, 
> &hints);
> +                if (r < 0)
> +                        log_error("Error: %s %d\n", gai_strerror(r), r);
> +
> +                while (!sd_resolve_is_done(q)) {
> +                        r = sd_resolve_wait(resolve, (uint64_t) -1);
> +                        if (r < 0) {
> +                                log_error("Error: %s\n", strerror(-r));
> +                                assert_not_reached("sd_resolve_wait() 
> failed");
> +                        }
> +                }
> +
> +                r = sd_resolve_getaddrinfo_done(q, &result);
> +                if (r < 0) {
>                          log_error("Failed to resolve host %s:%s: %s", node, 
> service, gai_strerror(r));
>                          return -EHOSTUNREACH;
>                  }

Yupp, as David already pointed out, this takes the async API and makes
it sync again...

I figure before we can implement this part in the socket proxy we need
to enhance sd-resolve to provide hooks into the event loop. And that
probably means we also need to teach it callbacks... 

So I figure this is a bit more difficult to do...

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to