gpointer user_data)
{
ReadKdbusData *data;
+ GSource *source;
data = g_new0 (ReadKdbusData, 1);
data->kdbus = kdbus; /*g_object_ref (socket);*/
_g_kdbus_read);
g_simple_async_result_set_check_cancellable (data->simple, cancellable);
- if (!g_kdbus_condition_check (kdbus, G_IO_IN))
- {
- GSource *source;
- data->from_mainloop = TRUE;
- source = g_kdbus_create_source (data->kdbus,
- G_IO_IN | G_IO_HUP | G_IO_ERR,
- cancellable);
- g_source_set_callback (source,
- (GSourceFunc) _g_kdbus_read_ready,
- data,
- (GDestroyNotify) read_kdbus_data_free);
- g_source_attach (source, g_main_context_get_thread_default ());
- g_source_unref (source);
- }
- else
- {
- _g_kdbus_read_ready (data->kdbus, G_IO_IN, data);
- read_kdbus_data_free (data);
- }
+ data->from_mainloop = TRUE;
+ source = g_kdbus_create_source (data->kdbus,
+ G_IO_IN | G_IO_HUP | G_IO_ERR,
+ cancellable);
+ g_source_set_callback (source,
+ (GSourceFunc) _g_kdbus_read_ready,
+ data,
+ (GDestroyNotify) read_kdbus_data_free);
+ g_source_attach (source, g_main_context_get_thread_default ());
+ g_source_unref (source);
}
static void
read_message_print_transport_debug (bytes_read, worker);
worker->read_buffer_cur_size += bytes_read;
+
+ /* TODO: [KDBUS] Sprawdzic pole read_buffer_bytes_wanted */
+ if (G_IS_KDBUS_CONNECTION (worker->stream))
+ worker->read_buffer_bytes_wanted = worker->read_buffer_cur_size;
+
if (worker->read_buffer_bytes_wanted == worker->read_buffer_cur_size)
{
/* OK, got what we asked for! */
static gboolean
_g_dbus_worker_do_initial_read (gpointer data)
{
- //GDBusWorker *worker = data;
- //g_mutex_lock (&worker->read_lock);
- //_g_dbus_worker_do_read_unlocked (worker);
- //g_mutex_unlock (&worker->read_lock);
+ GDBusWorker *worker = data;
+ g_mutex_lock (&worker->read_lock);
+ _g_dbus_worker_do_read_unlocked (worker);
+ g_mutex_unlock (&worker->read_lock);
return FALSE;
}
GError *error;
error = NULL;
data->total_written = g_kdbus_send_message(data->worker, data->worker->kdbus, data->message, data->blob, data->blob_size, &error);
-
- if (data->total_written == data->blob_size)
- {
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
- goto out;
- }
+
+ write_message_print_transport_debug (data->total_written, data);
+ g_simple_async_result_complete (simple);
+ g_object_unref (simple);
+ goto out;
}
else
{
return TRUE;
}
+/* TODO: [KDBUS] To remove */
+/*
GIOCondition
-g_kdbus_condition_check(GKdbus *kdbus,
- GIOCondition condition)
+g_kdbus_condition_check (GKdbus *kdbus,
+ GIOCondition condition)
{
GPollFD poll_fd;
gint result;
while (result == -1 && errno == EINTR);
return poll_fd.revents;
-
}
-
+*/
/*
* g_kdbus_decode_msg:
return blob_size;
}
-/***************************************************************************************************************
-
-
-/**
- * g_kdbus_send:
- * @kdbus: a #GKdbus
- */
-/*gssize
-g_kdbus_send (GKdbus *kdbus,
- const gchar *buffer,
- gsize size,
- GCancellable *cancellable,
- GError **error)
-{
- // TODO
-}*/
-
-
-
-
-/**
- * g_kdbus_receive_message:
- * @kdbus: a #Gkdbus
- */
-/*gssize
-g_kdbus_receive_message (Gkdbus *kdbus,
- GkdbusAddress **address,
- GInputVector *vectors,
- gint num_vectors,
- GkdbusControlMessage ***messages,
- gint *num_messages,
- gint *flags,
- GCancellable *cancellable,
- GError **error)
-{
- //TODO
-}*/