Backport !1711 “Fix race in socketclient-slow test” to glib-2-66
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 (closed)
Trivial backport of !1711 (merged) to