- g_assert (output_stream->priv->result == NULL);
-
- output_stream->priv->result =
- g_simple_async_result_new (G_OBJECT (stream), callback, user_data,
- g_socket_output_stream_write_async);
- if (cancellable)
- g_object_ref (cancellable);
- output_stream->priv->cancellable = cancellable;
- output_stream->priv->buffer = buffer;
- output_stream->priv->count = count;
-
- if (!g_socket_condition_check (output_stream->priv->socket, G_IO_OUT))
- {
- GSource *source;
-
- output_stream->priv->from_mainloop = TRUE;
- source = g_socket_create_source (output_stream->priv->socket,
- G_IO_OUT | G_IO_HUP | G_IO_ERR,
- cancellable);
- g_source_set_callback (source,
- (GSourceFunc) g_socket_output_stream_write_ready,
- g_object_ref (output_stream), g_object_unref);
- g_source_attach (source, g_main_context_get_thread_default ());
- g_source_unref (source);
- }
- else
- {
- output_stream->priv->from_mainloop = FALSE;
- g_socket_output_stream_write_ready (output_stream->priv->socket, G_IO_OUT, output_stream);
- }