I have fixed the issue.
This is the change in the code:
if (connect(sock, saPtr, Ns_SockaddrGetSockLen(saPtr)) != 0) {
int err = ns_sockerrno;
#ifndef _WIN32
if (!async || (err != EINPROGRESS && err != EWOULDBLOCK)) {
#else
if (!async || (err != WSAEWOULDBLOCK)) {
#endif
ns_sockclose(sock);
Ns_LogSockaddr(Warning, "SockConnect fails", saPtr);
sock = NS_INVALID_SOCKET;
The mod will be available in next version of my distribution.
Over the weekend.