Allow a single FD to be "leaked" in the TCP connect leak test.

On macOS, the kqueue mechanism appears to create an internal FD that wrongly triggers the leak condition.
This commit is contained in:
Sönke Ludwig 2019-11-02 14:56:57 +01:00
parent 262385e429
commit bef1c57315

View file

@ -19,15 +19,19 @@ void main()
auto initial = determineSocketCount();
foreach (i; 0 .. 3)
test();
assert(determineSocketCount() <= initial + 1, "Sockets leaked!");
}
void test()
{
TCPConnection conn;
try {
conn = connectTCP("127.0.0.1", 16565);
logError("Connection: %s", conn);
conn.close();
assert(false, "Didn't expect TCP connection on port 16565 to succeed");
} catch (Exception) { }
assert(determineSocketCount() == initial, "Sockets leaked!");
}
size_t determineSocketCount()