Skip to content

gioerror: Map EADDRNOTAVAIL to G_IO_ERROR_CONNECTION_REFUSED

Philip Withnall requested to merge wip/pwithnall/gsocket-eaddrnotavail-macos into main

Previously it was mapped (as a default) to G_IO_ERROR_FAILED.

It’s the error that macOS returns when trying to connect to a socket which is bound but not listened to. Linux returns ECONNREFUSED in this case. It’s helpful if they both map to the same GIOError value.

This should fix the /socket-client/connection-fail test on macOS, which is currently failing with:

 # GLib-GIO-DEBUG: GSocketClient: Starting TCP connection attempt
 # GLib-GIO-DEBUG: GSocketClient: Connection attempt failed: Can't assign requested address
 # GLib-GIO-DEBUG: GSocketClient: Starting new address enumeration
 # GLib-GIO-DEBUG: GSocketClient: Address enumeration completed (out of addresses)
 # GLib-GIO-DEBUG: GSocketClient: Address enumeration failed: (null)
 # GLib-GIO-DEBUG: GSocketClient: Connection failed: Could not connect to localhost: Can't assign requested address
not ok /socket-client/connection-fail - GLib-GIO:ERROR:../gio/tests/gsocketclient-slow.c:231:test_connection_failed: assertion failed (local_error == (g-io-error-quark, 39)): Could not connect to localhost: Can't assign requested address (g-io-error-quark, 0)
Bail out!

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

See: #3184 (closed) Fixes: #3394 (closed)

Merge request reports