gsocket: Factor out blocking parameter from g_socket_send_messages()
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Fri, 12 Jun 2015 07:32:11 +0000 (08:32 +0100)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Thu, 23 Jul 2015 10:37:18 +0000 (11:37 +0100)
This will make future API additions easier. The factored version is
internal for the time being.

https://bugzilla.gnome.org/show_bug.cgi?id=751924

gio/gsocket.c

index 6856d0e..938f6bd 100644 (file)
@@ -134,6 +134,15 @@ static gboolean g_socket_initable_init       (GInitable       *initable,
                                              GCancellable    *cancellable,
                                              GError         **error);
 
+static gint
+g_socket_send_messages_with_blocking   (GSocket        *socket,
+                                        GOutputMessage *messages,
+                                        guint           num_messages,
+                                        gint            flags,
+                                        gboolean        blocking,
+                                        GCancellable   *cancellable,
+                                        GError        **error);
+
 enum
 {
   PROP_0,
@@ -4044,6 +4053,20 @@ g_socket_send_messages (GSocket        *socket,
                        GCancellable   *cancellable,
                        GError        **error)
 {
+  return g_socket_send_messages_with_blocking (socket, messages, num_messages,
+                                               flags, socket->priv->blocking,
+                                               cancellable, error);
+}
+
+static gint
+g_socket_send_messages_with_blocking (GSocket        *socket,
+                                      GOutputMessage *messages,
+                                      guint           num_messages,
+                                      gint            flags,
+                                      gboolean        blocking,
+                                      GCancellable   *cancellable,
+                                      GError        **error)
+{
   g_return_val_if_fail (G_IS_SOCKET (socket), -1);
   g_return_val_if_fail (num_messages == 0 || messages != NULL, -1);
   g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), -1);
@@ -4183,7 +4206,7 @@ g_socket_send_messages (GSocket        *socket,
             if (errsv == EINTR)
               continue;
 
-            if (socket->priv->blocking &&
+            if (blocking &&
                 (errsv == EWOULDBLOCK ||
                  errsv == EAGAIN))
               {