socket test: Adjust for Windows-specific sendto() error

With winsock sending messages to NULL results in G_IO_ERROR_NOT_CONNECTED
instead of G_IO_ERROR_FAILED.
MSDN says:
  WSAENOTCONN
  10057
  Socket is not connected.
  A request to send or receive data was disallowed because the socket is not connected
  and (when sending on a datagram socket using sendto) no address was supplied.
So this is a direct mapping of the implementation error.
Covering it up in the wrapper (by converting it to G_IO_ERROR_FAILED)
doesn't seem feasible or needed (no one, except for the testsuite,
really cares which unrecoverable error is returned by sendto()).
This commit is contained in:
Руслан Ижбулатов 2019-02-11 23:43:14 +00:00 committed by Philip Withnall
parent 16dc979d0e
commit 1f5d7eeaa7

View File

@ -757,7 +757,12 @@ test_ip_sync_dgram (GSocketFamily family)
m[1].address = NULL;
m[2].address = NULL;
len = g_socket_send_messages (client, m, G_N_ELEMENTS (m), 0, NULL, &error);
/* This error code may vary between platforms and over time; it is not guaranteed API: */
#ifndef G_OS_WIN32
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
#else
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_CONNECTED);
#endif
g_clear_error (&error);
g_assert_cmpint (len, ==, -1);