Adjust UDP test for macOS loopback behavior.
This commit is contained in:
parent
86ff9ea0d0
commit
e8a0968ded
|
@ -7,7 +7,7 @@ module test;
|
||||||
import eventcore.core;
|
import eventcore.core;
|
||||||
import eventcore.socket;
|
import eventcore.socket;
|
||||||
import std.socket : InternetAddress;
|
import std.socket : InternetAddress;
|
||||||
import core.time : Duration;
|
import core.time : Duration, msecs;
|
||||||
|
|
||||||
DatagramSocket s_baseSocket;
|
DatagramSocket s_baseSocket;
|
||||||
DatagramSocket s_freeSocket;
|
DatagramSocket s_freeSocket;
|
||||||
|
@ -41,6 +41,9 @@ void main()
|
||||||
assert(bytes == pack2.length);
|
assert(bytes == pack2.length);
|
||||||
})(pack2, IOMode.once, baddr);
|
})(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) {
|
s_baseSocket.receive!((status, bts, scope addr) {
|
||||||
log("receive2: %s %s", status, bts);
|
log("receive2: %s %s", status, bts);
|
||||||
assert(status == IOStatus.ok);
|
assert(status == IOStatus.ok);
|
||||||
|
@ -53,9 +56,10 @@ void main()
|
||||||
s_done = true;
|
s_done = true;
|
||||||
log("done.");
|
log("done.");
|
||||||
|
|
||||||
// FIXME: this shouldn't ne necessary:
|
// FIXME: this shouldn't be necessary:
|
||||||
eventDriver.core.exit();
|
eventDriver.core.exit();
|
||||||
})(s_rbuf, IOMode.immediate);
|
})(s_rbuf, IOMode.immediate);
|
||||||
|
});
|
||||||
})(s_rbuf, IOMode.once);
|
})(s_rbuf, IOMode.once);
|
||||||
s_connectedSocket.send!((status, bytes) {
|
s_connectedSocket.send!((status, bytes) {
|
||||||
log("send1: %s %s", status, bytes);
|
log("send1: %s %s", status, bytes);
|
||||||
|
|
Loading…
Reference in a new issue