Properly increment the waiter count during async TCP connect.

This commit is contained in:
Sönke Ludwig 2017-12-16 17:55:13 +01:00
parent 979640b074
commit c45f7dc35e

View file

@ -72,6 +72,8 @@ final class WinAPIEventDriverSockets : EventDriverSockets {
connectCallback = on_connect;
state = ConnectionState.connecting;
}
m_core.addWaiter();
addRef(sock);
return sock;
} else {
@ -787,6 +789,7 @@ final class WinAPIEventDriverSockets : EventDriverSockets {
case FD_CONNECT:
auto cb = slot.streamSocket.connectCallback;
slot.streamSocket.connectCallback = null;
slot.common.driver.m_core.removeWaiter();
if (err) {
slot.streamSocket.state = ConnectionState.closed;
cb(cast(StreamSocketFD)sock, ConnectStatus.refused);