mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 07:26:15 +01:00
gioerror: Map EADDRNOTAVAIL to G_IO_ERROR_CONNECTION_REFUSED
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](https://gitlab.gnome.org/GNOME/glib/-/jobs/3970547) 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 Fixes: #3394
This commit is contained in:
parent
ea58dcb538
commit
f09a8e2be4
@ -208,6 +208,12 @@ g_io_error_from_errno (gint err_no)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EADDRNOTAVAIL
|
||||||
|
case EADDRNOTAVAIL:
|
||||||
|
return G_IO_ERROR_CONNECTION_REFUSED;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ECONNRESET
|
#ifdef ECONNRESET
|
||||||
case ECONNRESET:
|
case ECONNRESET:
|
||||||
return G_IO_ERROR_CONNECTION_CLOSED;
|
return G_IO_ERROR_CONNECTION_CLOSED;
|
||||||
|
@ -572,7 +572,7 @@ test_error_from_errno (void)
|
|||||||
|
|
||||||
#ifdef EADDRNOTAVAIL
|
#ifdef EADDRNOTAVAIL
|
||||||
g_assert_cmpuint (g_io_error_from_errno (EADDRNOTAVAIL), ==,
|
g_assert_cmpuint (g_io_error_from_errno (EADDRNOTAVAIL), ==,
|
||||||
G_IO_ERROR_FAILED);
|
G_IO_ERROR_CONNECTION_REFUSED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENETDOWN
|
#ifdef ENETDOWN
|
||||||
|
Loading…
Reference in New Issue
Block a user