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.socket;
|
||||
import std.socket : InternetAddress;
|
||||
import core.time : Duration;
|
||||
import core.time : Duration, msecs;
|
||||
|
||||
DatagramSocket s_baseSocket;
|
||||
DatagramSocket s_freeSocket;
|
||||
|
@ -41,21 +41,25 @@ void main()
|
|||
assert(bytes == pack2.length);
|
||||
})(pack2, IOMode.once, baddr);
|
||||
|
||||
s_baseSocket.receive!((status, bts, scope addr) {
|
||||
log("receive2: %s %s", status, bts);
|
||||
assert(status == IOStatus.ok);
|
||||
assert(bts == pack2.length);
|
||||
assert(s_rbuf[0 .. pack2.length] == pack2);
|
||||
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);
|
||||
assert(bts == pack2.length);
|
||||
assert(s_rbuf[0 .. pack2.length] == pack2);
|
||||
|
||||
destroy(s_baseSocket);
|
||||
destroy(s_freeSocket);
|
||||
destroy(s_connectedSocket);
|
||||
s_done = true;
|
||||
log("done.");
|
||||
destroy(s_baseSocket);
|
||||
destroy(s_freeSocket);
|
||||
destroy(s_connectedSocket);
|
||||
s_done = true;
|
||||
log("done.");
|
||||
|
||||
// FIXME: this shouldn't ne necessary:
|
||||
eventDriver.core.exit();
|
||||
})(s_rbuf, IOMode.immediate);
|
||||
// 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);
|
||||
|
|
Loading…
Reference in a new issue