2016-10-24 06:32:16 +00:00
|
|
|
/++ dub.sdl:
|
|
|
|
name "test"
|
|
|
|
description "TCP disconnect task issue"
|
|
|
|
dependency "vibe-core" path="../../"
|
|
|
|
+/
|
|
|
|
module test;
|
|
|
|
|
2016-02-26 20:59:40 +00:00
|
|
|
import vibe.core.core;
|
|
|
|
import vibe.core.net;
|
|
|
|
import core.time : msecs;
|
2016-06-18 08:00:20 +00:00
|
|
|
import std.string : representation;
|
2016-02-26 20:59:40 +00:00
|
|
|
|
2016-06-18 06:19:06 +00:00
|
|
|
void main()
|
2016-02-26 20:59:40 +00:00
|
|
|
{
|
|
|
|
import vibe.core.log;
|
|
|
|
bool done = false;
|
2016-06-18 08:00:20 +00:00
|
|
|
listenTCP(11375, (conn) {
|
|
|
|
try {
|
|
|
|
conn.write("foo".representation);
|
|
|
|
conn.close();
|
|
|
|
} catch (Exception e) {
|
|
|
|
assert(false, e.msg);
|
|
|
|
}
|
2016-02-26 20:59:40 +00:00
|
|
|
done = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
runTask({
|
|
|
|
auto conn = connectTCP("127.0.0.1", 11375);
|
|
|
|
conn.close();
|
|
|
|
|
|
|
|
sleep(50.msecs);
|
|
|
|
assert(done);
|
|
|
|
|
|
|
|
exitEventLoop();
|
|
|
|
});
|
2016-06-18 06:19:06 +00:00
|
|
|
|
|
|
|
runEventLoop();
|
2016-02-26 20:59:40 +00:00
|
|
|
}
|