https://bugs.winehq.org/show_bug.cgi?id=51442
--- Comment #24 from Zebediah Figura z.figura12@gmail.com --- I suspect, but haven't confirmed, that we're racing between sock_error() and poll(). It looks like connection fails, signaling AFD_POLL_WRITE (is this correct?) while also returning STATUS_CONNECTION_REFUSED. select() throws that status away because it doesn't care, though, and after the request completes the program checks for SO_ERROR, but the error was already swallowed.
I'm not sure it's correct that we're signaling AFD_POLL_WRITE, and even if it is we need to check whether select() should be signalling the writefd and returning success here.