Skip to content

Commit

Permalink
Add test for issue #1452.
Browse files Browse the repository at this point in the history
TCP connection should not crash the program if they are closed from within a finalizer. Instead, give a warning if such a class has leaked.
  • Loading branch information
s-ludwig committed Mar 11, 2016
1 parent 997d78a commit 2c0adbc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/vibe.core.net.1452/dub.sdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name "tests"
description "Invalid memory operation on TCP connection leakage at shutdown"
dependency "vibe-d:core" path="../../"
23 changes: 23 additions & 0 deletions tests/vibe.core.net.1452/source/app.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import vibe.core.core;
import vibe.core.net;
import core.time : msecs;

class C {
TCPConnection m_conn;

this()
{
m_conn = connectTCP("google.com", 443);
}

~this()
{
m_conn.close();
}
}

void main()
{
auto c = new C;
// let druntime collect c during shutdown
}

0 comments on commit 2c0adbc

Please sign in to comment.