Kernel events without kevents
Posted Mar 16, 2007 2:59 UTC (Fri) by
wahern (subscriber, #37304)
In reply to:
Kernel events without kevents by pphaneuf
Parent article:
Kernel events without kevents
Huh? I've been using asynchronous DNS resolvers for years:
ADNS
C-Ares
UDNS
My core event loop is libevent, which handles callbacks for signals, timers and I/O readiness. I
currently use C-Ares for sending and receiving raw DNS messages, and my lookup API in my
async meta-API library libevnet (since C-Ares tries to mirror the useless gethostbyname
interface). In libevnet you can ask for an MX+A record, and it will ultimately always get back A
(and/or AAAA if you specified) records suitable for sending mail. And this can be expanded
upon, so that you can take ask the library to do the smart thing:
s = socket_open(&socket_defaults);
socket_name_init(&n, "google.com", "smtp", LOOKUP_IN_MX|LOOKUP_IN_A|LOOKUP_IN_AAAA)
tv.tv_sec = 5;
socket_connect(s, &n, &my_callback, my_arg, &tv);
(
Log in to post comments)