Fix gsocketclient-slow test on FreeBSD

The "port" variable ends up being 0 even after successful g_socket_bind.
Use g_socket_get_local_address() to actually get a correct port number.
This commit is contained in:
Gleb Popov 2024-06-30 15:37:22 +03:00
parent 616749c1e2
commit 6daebde9a6

View File

@ -212,6 +212,9 @@ test_connection_failed (void)
g_assert_no_error (local_error);
/* reserve a port without listening so we know that connecting to it will fail */
g_object_unref (address);
address = g_socket_get_local_address (socket, &local_error);
g_assert_no_error (local_error);
port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (address));
client = g_socket_client_new ();