2016-10-16 12:30:52 +00:00
|
|
|
/++ dub.sdl:
|
|
|
|
name "test"
|
|
|
|
dependency "eventcore" path=".."
|
|
|
|
+/
|
|
|
|
module test;
|
|
|
|
|
|
|
|
import eventcore.core;
|
|
|
|
import std.stdio : writefln;
|
2016-10-19 20:00:06 +00:00
|
|
|
import core.time : Duration;
|
2016-10-16 12:30:52 +00:00
|
|
|
|
|
|
|
bool s_done;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
eventDriver.dns.lookupHost("example.org", (id, status, scope addrs) {
|
|
|
|
assert(status == DNSStatus.ok);
|
|
|
|
assert(addrs.length >= 1);
|
|
|
|
foreach (a; addrs) {
|
|
|
|
scope (failure) assert(false);
|
|
|
|
writefln("%s (%s)", a.toAddrString(), a.toServiceNameString());
|
|
|
|
}
|
|
|
|
s_done = true;
|
|
|
|
eventDriver.core.exit();
|
|
|
|
});
|
|
|
|
|
|
|
|
ExitReason er;
|
2016-10-19 20:00:06 +00:00
|
|
|
do er = eventDriver.core.processEvents(Duration.max);
|
2016-10-16 12:30:52 +00:00
|
|
|
while (er == ExitReason.idle);
|
|
|
|
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
|
|
|
assert(s_done);
|
|
|
|
s_done = false;
|
|
|
|
}
|