GCond cond;
GMutex mutex;
GError *error;
+
+ gboolean writable;
} WriteData;
static void
WriteData *write_data = user_data;
g_mutex_lock (&write_data->mutex);
+ g_cancellable_set_error_if_cancelled (cancellable, &write_data->error);
g_cond_broadcast (&write_data->cond);
g_mutex_unlock (&write_data->mutex);
-
- g_cancellable_set_error_if_cancelled (cancellable, &write_data->error);
}
static void
WriteData *write_data = user_data;
g_mutex_lock (&write_data->mutex);
+ write_data->writable = TRUE;
g_cond_broadcast (&write_data->cond);
g_mutex_unlock (&write_data->mutex);
}
* it will take the agent lock which will cause a deadlock if one of
* the callbacks is called.
*/
+ write_data->writable = FALSE;
g_mutex_unlock (&write_data->mutex);
_len = nice_agent_send_full (agent, self->priv->stream_id,
g_error_matches (child_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
/* EWOULDBLOCK. */
g_clear_error (&child_error);
- g_cond_wait (&write_data->cond, &write_data->mutex);
+ if (!write_data->writable && !write_data->error)
+ g_cond_wait (&write_data->cond, &write_data->mutex);
} else if (_len > 0) {
/* Success. */
len += _len;