Adjust UDP test for macOS loopback behavior.

This commit is contained in:
Sönke Ludwig 2017-01-23 19:34:42 +01:00
parent 86ff9ea0d0
commit e8a0968ded

View file

@ -7,7 +7,7 @@ module test;
import eventcore.core;
import eventcore.socket;
import std.socket : InternetAddress;
import core.time : Duration;
import core.time : Duration, msecs;
DatagramSocket s_baseSocket;
DatagramSocket s_freeSocket;
@ -41,6 +41,9 @@ void main()
assert(bytes == pack2.length);
})(pack2, IOMode.once, baddr);
auto tm = eventDriver.timers.create();
eventDriver.timers.set(tm, 50.msecs, 0.msecs);
eventDriver.timers.wait(tm, (tm) {
s_baseSocket.receive!((status, bts, scope addr) {
log("receive2: %s %s", status, bts);
assert(status == IOStatus.ok);
@ -53,9 +56,10 @@ void main()
s_done = true;
log("done.");
// FIXME: this shouldn't ne necessary:
// FIXME: this shouldn't be necessary:
eventDriver.core.exit();
})(s_rbuf, IOMode.immediate);
});
})(s_rbuf, IOMode.once);
s_connectedSocket.send!((status, bytes) {
log("send1: %s %s", status, bytes);