gsocket: Factor out blocking parameter from g_socket_send_messages()

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
This commit is contained in:
Philip Withnall 2015-06-12 08:32:11 +01:00
parent b65287fea5
commit 8520ae3ffa

View 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,
@ -4043,6 +4052,20 @@ g_socket_send_messages (GSocket *socket,
gint flags,
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);
@ -4183,7 +4206,7 @@ g_socket_send_messages (GSocket *socket,
if (errsv == EINTR)
continue;
if (socket->priv->blocking &&
if (blocking &&
(errsv == EWOULDBLOCK ||
errsv == EAGAIN))
{