v2: [Testbot run with this patch](https://testbot.winehq.org/JobDetails.pl?Key=161893) - Use port 255. - Call check_events twice. - Clear the error only with SOCK_UNCONNECTED, remove the `if (sock->type == WS_SOCK_STREAM)`. - Clear only the AFD_POLL_CONNECT_ERR in `reported_events`. - Clear the AFD_POLL_CONNECT_ERR also in `pending_events`. - Run this test only with winetest_interactive. - Change patch title to better reflect what it is about. TODO: - Add test: "I.e. if you fail connection, don't check events, and then successfully connect, I would expect that the connection failure is not reported. Ideally this too should be tested." - Add test: "I'm also curious if trying to connect with an invalid address will report this behaviour. If not, we want to clear reported_events under that check." -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10044#note_129551