Avoid a possible concurrent write to the same socket.
This commit is contained in:
parent
e66b29d8df
commit
e8f35c0e0f
|
@ -38,12 +38,16 @@ void main()
|
||||||
assert(bts == pack1.length);
|
assert(bts == pack1.length);
|
||||||
assert(s_rbuf[0 .. pack1.length] == pack1);
|
assert(s_rbuf[0 .. pack1.length] == pack1);
|
||||||
|
|
||||||
print("Second write");
|
auto tmw = eventDriver.timers.create();
|
||||||
client.write!((status, bytes) {
|
eventDriver.timers.set(tmw, 20.msecs, 0.msecs);
|
||||||
print("Second write done");
|
eventDriver.timers.wait(tmw, (tmw) {
|
||||||
assert(status == IOStatus.ok);
|
print("Second write");
|
||||||
assert(bytes == pack2.length);
|
client.write!((status, bytes) {
|
||||||
})(pack2, IOMode.once);
|
print("Second write done");
|
||||||
|
assert(status == IOStatus.ok);
|
||||||
|
assert(bytes == pack2.length);
|
||||||
|
})(pack2, IOMode.once);
|
||||||
|
});
|
||||||
|
|
||||||
print("Second read");
|
print("Second read");
|
||||||
incoming.read!((status, bts) {
|
incoming.read!((status, bts) {
|
||||||
|
|
Loading…
Reference in a new issue