StreamingSocket bug

When connecting to a nonexisting address, SocketHelpers::connectSocket always returns true. Problem is:


            if (result < 0)
            {
               #if JUCE_WINDOWS
                if (result == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK)
               #else
                if (errno == EINPROGRESS)
               #endif
                    {
                        if (waitForReadiness (handle, readLock, false, timeOutMillisecs) != 1)
                        {
                            setSocketBlockingState (handle, true);
                            return false;
                        }
                    }
            }
            setSocketBlockingState (handle, true);
            resetSocketOptions (handle, false, false);
            return true;

if errno == SOCKET_ERROR, true will be returned.

 

I propose:


          if (result < 0)
            {
               #if JUCE_WINDOWS
                if (result == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK)
               #else
                if (errno == EINPROGRESS)
               #endif
                {
                    if (waitForReadiness (handle, readLock, false, timeOutMillisecs) != 1)
                    {
                        setSocketBlockingState (handle, true);
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }

Which should work...

 

Thank you for reporting. Fixed in latest tip!