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