Fix race in socketclient-slow test

Merged Michael Catanzaro requested to merge mcatanzaro/#2221 into master
Fix race in socketclient-slow test

This test ensures that g_socket_client_connect_to_host_async() fails if
it is cancelled, but it's not cancelled until after 1 millisecond. Our
CI testers are hitting that race window, and Milan is able to reproduce
the crash locally as well. Switching it from 1ms to 0ms is enough for
Milan to avoid the crash, but not enough for our CI, so let's move the
cancellation to a GSocketClientEvent callback where the timing is
completely deterministic.

Hopefully fixes #2221
Edited by Michael Catanzaro

Merge request reports