[glib/socket.win32] Win32: gio/gsocket.c: Set WSAEWOULDLOBCK on G_POLLABLE_RETURN_WOULD_BLOCK



commit 30a0782e1f73383f6fd5a447687ea3c691b086ab
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Feb 4 13:03:19 2019 +0800

    Win32: gio/gsocket.c: Set WSAEWOULDLOBCK on G_POLLABLE_RETURN_WOULD_BLOCK
    
    To make things consistent across the board as that is the WinSock2 error
    code that is received by g_socket_send_message_with_timeout() when it
    returns G_POLLABLE_RETURN_WOULD_BLOCK.

 gio/gsocket.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index b1db8e645..92baa62ea 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -4609,7 +4609,13 @@ g_socket_send_message (GSocket                *socket,
                                             cancellable, error);
 
   if (res == G_POLLABLE_RETURN_WOULD_BLOCK)
-    socket_set_error_lazy (error, EWOULDBLOCK, _("Error sending message: %s"));
+    {
+#ifndef G_OS_WIN32
+      socket_set_error_lazy (error, EWOULDBLOCK, _("Error sending message: %s"));
+#else
+      socket_set_error_lazy (error, WSAEWOULDBLOCK, _("Error sending message: %s"));
+#endif
+    }
 
   return res == G_POLLABLE_RETURN_OK ? bytes_written : -1;
 }
@@ -5056,7 +5062,13 @@ g_socket_send_messages_with_timeout (GSocket        *socket,
                                                               cancellable, &msg_error);
 
         if (pollable_result == G_POLLABLE_RETURN_WOULD_BLOCK)
-          socket_set_error_lazy (&msg_error, EWOULDBLOCK, _("Error sending message: %s"));
+          {
+#ifndef G_OS_WIN32
+            socket_set_error_lazy (&msg_error, EWOULDBLOCK, _("Error sending message: %s"));
+#else
+            socket_set_error_lazy (&msg_error, WSAEWOULDBLOCK, _("Error sending message: %s"));
+#endif
+          }
 
         result = pollable_result == G_POLLABLE_RETURN_OK ? bytes_written : -1;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]