Call the callback on connectStream socket creation failure.

The callback must *always* be called at some point, because the generic async->sync logic in vibe-core otherwise has no way to know whether to expect a callback or not.
This commit is contained in:
Sönke Ludwig 2018-03-14 20:43:40 +01:00
parent 0044946413
commit 02de8341aa
3 changed files with 8 additions and 2 deletions

View file

@ -90,7 +90,10 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
assert(on_connect !is null);
auto sockfd = createSocket(address.addressFamily, SOCK_STREAM);
if (sockfd == -1) return StreamSocketFD.invalid;
if (sockfd == -1) {
on_connect(StreamSocketFD.invalid, ConnectStatus.socketCreateFailure);
return StreamSocketFD.invalid;
}
auto sock = cast(StreamSocketFD)sockfd;