suppressing socketStream warnings during shutdown initiated by SIGINT
This commit is contained in:
parent
a027c233c2
commit
a462db4e04
|
@ -21,6 +21,7 @@ import eventcore.internal.utils;
|
|||
|
||||
import core.time : MonoTime;
|
||||
import std.algorithm.comparison : among, min, max;
|
||||
import std.format : format;
|
||||
|
||||
version (Posix) {
|
||||
package alias sock_t = int;
|
||||
|
@ -116,14 +117,23 @@ final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver {
|
|||
return thname.length ? thname : "unknown";
|
||||
}
|
||||
|
||||
if (m_loop.m_handleCount > 0) {
|
||||
print("Warning (thread: %s): leaking eventcore driver because there are still active handles", getThreadName());
|
||||
foreach (id, ref s; m_loop.m_fds)
|
||||
if (!s.specific.hasType!(typeof(null)) && !(s.common.flags & FDFlags.internal))
|
||||
print(" FD %s (%s)", id, s.specific.kind);
|
||||
return false;
|
||||
string leaking_handle_desc;
|
||||
foreach (id, ref s; m_loop.m_fds) {
|
||||
if (!s.specific.hasType!(typeof(null)) && !(s.common.flags & FDFlags.internal) &&
|
||||
(!s.specific.hasType!(StreamSocketSlot) || s.streamSocket.state == ConnectionState.connected))
|
||||
try {
|
||||
leaking_handle_desc ~= format!" FD %s (%s)\n"(id, s.specific.kind);
|
||||
} catch (Exception ex) { print("exception happened in Driver.dispose() during formatting"); }
|
||||
}
|
||||
|
||||
if(leaking_handle_desc.length) {
|
||||
print("Warning (thread: %s): leaking eventcore driver because there are still active handles", getThreadName());
|
||||
print(leaking_handle_desc);
|
||||
}
|
||||
|
||||
if (m_loop.m_handleCount > 0)
|
||||
return false;
|
||||
|
||||
m_processes.dispose();
|
||||
m_files.dispose();
|
||||
m_dns.dispose();
|
||||
|
|
Loading…
Reference in a new issue