[Spice-devel] [PATCH v3 06/13] Usbredir Channel: Change disconnect signature to reuse in async context

Kirill Moizik kirill at daynix.com
Mon Aug 3 06:10:46 PDT 2015


From: Kirill Moizik <kmoizik at redhat.com>

---
 src/channel-usbredir-priv.h |  4 +++-
 src/channel-usbredir.c      | 10 ++++++----
 src/usb-device-manager.c    |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/channel-usbredir-priv.h b/src/channel-usbredir-priv.h
index c987474..f2e17e3 100644
--- a/src/channel-usbredir-priv.h
+++ b/src/channel-usbredir-priv.h
@@ -47,7 +47,9 @@ gboolean spice_usbredir_channel_connect_device_finish(
                                         GAsyncResult         *res,
                                         GError              **err);
 
-void spice_usbredir_channel_disconnect_device(SpiceUsbredirChannel *channel);
+void spice_usbredir_channel_disconnect_device(GSimpleAsyncResult *simple,
+                                              GObject *object,
+                                              GCancellable *cancellable);
 
 libusb_device *spice_usbredir_channel_get_device(SpiceUsbredirChannel *channel);
 
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 7394b81..f1bd815 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -121,7 +121,7 @@ static void spice_usbredir_channel_reset(SpiceChannel *c, gboolean migrating)
 
     if (priv->host) {
         if (priv->state == STATE_CONNECTED)
-            spice_usbredir_channel_disconnect_device(channel);
+            spice_usbredir_channel_disconnect_device_async(channel, result, NULL);
         usbredirhost_close(priv->host);
         priv->host = NULL;
         /* Call set_context to re-create the host */
@@ -152,7 +152,7 @@ static void spice_usbredir_channel_dispose(GObject *obj)
 {
     SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(obj);
 
-    spice_usbredir_channel_disconnect_device(channel);
+    spice_usbredir_channel_disconnect_device(NULL, G_OBJECT(channel), NULL);
 
     /* Chain up to the parent class */
     if (G_OBJECT_CLASS(spice_usbredir_channel_parent_class)->dispose)
@@ -424,7 +424,9 @@ gboolean spice_usbredir_channel_connect_device_finish(
 }
 
 G_GNUC_INTERNAL
-void spice_usbredir_channel_disconnect_device(SpiceUsbredirChannel *channel)
+void spice_usbredir_channel_disconnect_device(GSimpleAsyncResult *simple,
+                                              GObject *object,
+                                              GCancellable *cancellable)
 {
     SpiceUsbredirChannelPrivate *priv = channel->priv;
 
@@ -643,7 +645,7 @@ static gboolean device_error(gpointer user_data)
 
     /* Check that the device has not changed before we manage to run */
     if (data->spice_device == priv->spice_device) {
-        spice_usbredir_channel_disconnect_device(channel);
+        spice_usbredir_channel_disconnect_device(NULL, G_OBJECT(channel), NULL);
         spice_usb_device_manager_device_error(
                 spice_usb_device_manager_get(
                     spice_channel_get_session(SPICE_CHANNEL(channel)), NULL),
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 65c6568..901a1b9 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1686,7 +1686,7 @@ void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
 
     channel = spice_usb_device_manager_get_channel_for_dev(self, device);
     if (channel)
-        spice_usbredir_channel_disconnect_device(channel);
+        spice_usbredir_channel_disconnect_device(NULL, G_OBJECT(channel), NULL);
 
 #ifdef G_OS_WIN32
     if (self->priv->use_usbclerk) {
-- 
2.4.3



More information about the Spice-devel mailing list