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