Skip to content

gsocketclient: Document delays/timeouts better

Philip Withnall requested to merge pwithnall/glib:socket-client-cleanups into main

If a connection attempt times out (on_connection_attempt_timeout() is called), and enumeration has completed, and the g_socket_connection_connect_async() operation is going to take much longer, the GSocketClient effectively stalls because it doesn’t start trying the next connection or enumeration.

Similarly, if a connection attempt times out, and enumeration has not completed, the next enumeration is started while the g_socket_connection_connect_async() call is still pending. If that call completes a short while after, the state handling logic now has a pending enumeration call ongoing while a connection has just succeeded (or failed). It might not be set up to handle that.

Update: My understanding of Happy Eyeballs was incorrect, and I was confusing timeouts with delays (specifically, the connection attempt delay. That’s why this MR previously caused the tests to fail: because my proposed changes broke Happy Eyeballs. After re-reading the code, it seems GSocketClient does implement Happy Eyeballs’ connection attempt delays correctly, albeit it mislabels them as ‘timeouts’. I’ve pushed some commits here to try and improve that.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Edited by Philip Withnall

Merge request reports