Merge pull request #41 from vibe-d/fix_winapi_connect_waitercount

Properly increment the waiter count during async TCP connect.
This commit is contained in:
Sönke Ludwig 2017-12-16 18:25:14 +01:00 committed by GitHub
commit 135217066f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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);