worker->close_expected = TRUE;
worker->output_pending = PENDING_CLOSE;
- g_io_stream_close_async (worker->stream, G_PRIORITY_DEFAULT,
- NULL, iostream_close_cb,
- _g_dbus_worker_ref (worker));
+ if (G_IS_KDBUS_CONNECTION (worker->stream))
+ g_kdbus_connection_close (worker->stream, NULL, NULL);
+ else
+ g_io_stream_close_async (worker->stream, G_PRIORITY_DEFAULT,
+ NULL, iostream_close_cb,
+ _g_dbus_worker_ref (worker));
}
else
{
return FALSE;
}
+ #ifdef KDBUS_DEBUG
+ g_print (" KDBUS_DEBUG: (%s()): kdbus endpoint opened\n",__FUNCTION__);
+ #endif
+
kdbus->priv->closed = FALSE;
return TRUE;
}
{
g_return_val_if_fail (G_IS_KDBUS (kdbus), FALSE);
close(kdbus->priv->fd);
-
+
kdbus->priv->closed = TRUE;
kdbus->priv->fd = -1;
kdbus->priv->registered = FALSE;
+
+ #ifdef KDBUS_DEBUG
+ g_print (" KDBUS_DEBUG: (%s()): kdbus endpoint closed\n",__FUNCTION__);
+ #endif
return TRUE;
}
guint64 __attribute__ ((__aligned__(8))) offset;
struct kdbus_msg *msg;
+ /* TODO: Temporary hack */
+ if (kdbus->priv->closed == TRUE)
+ return 1;
+
//get memory offset of msg
again:
if (ioctl(kdbus->priv->fd, KDBUS_CMD_MSG_RECV, &offset) < 0)
{
if(errno == EINTR)
goto again;
- g_error (" KDBUS_DEBUG: (%s()): ioctl MSG_RECV failed!\n",__FUNCTION__);
- return -1;
+
+ /* TODO: Temporary hack */
+ if (errno == EAGAIN)
+ return 1;
+
+ g_error (" KDBUS_DEBUG: (%s()): ioctl MSG_RECV failed! %d (%m)\n",__FUNCTION__,errno);
+ return 1;
}
msg = (struct kdbus_msg *)((char*)kdbus->priv->buffer_ptr + offset);