On Fri, 10.04.15 15:26, Marcel Holtmann (mar...@holtmann.org) wrote: > >> +static int pac_dns_resolve(duk_context *ctx) { > >> + _cleanup_free_ char *address = NULL; > >> + struct addrinfo hints = {}; > >> + struct addrinfo *res, *addr; > >> + const char *hostname; > >> + int r; > >> + > >> + hostname = duk_require_string(ctx, 0); > >> + > >> + hints.ai_family = AF_INET; > >> + > >> + r = getaddrinfo(hostname, NULL, &hints, &res); > >> + if (r != 0) > >> + return 0; > > > > Hm, synchronous getaddrinfo() is nasty... Please use sd-resolve for > > this, which adds asynchronous getaddrinfo() for cases like this... > > you do realize that you want this synchronous. These are the magic > dnsResolve and myIpAddress Javascript functions that are expected to > be present when executing the PAC file. There are a few more, but > they can be implemented in Javascript and don't need a C > backend. These two actually need that. So you need to report the > result.
Ah I see, this function is only ever called from the PAC javascript code? OK, in that case it should be synchronous indeed. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel