[Spice-commits] server/smartcard.cpp server/smartcard.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 3 09:48:15 UTC 2020


 server/smartcard.cpp |   19 +++++--------------
 server/smartcard.h   |    1 -
 2 files changed, 5 insertions(+), 15 deletions(-)

New commits:
commit 6a230f3609e14b436197df76dc2c7474248c1c75
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sun Jun 2 16:06:17 2019 +0100

    smartcard: Remove usage of tokens
    
    RedCharDeviceSmartcard is not using token handling (which is designed
    only for VDAgent) so push directly to client.
    
    Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
    Acked-by: Julien Ropé <jrope at gmail.com>

diff --git a/server/smartcard.cpp b/server/smartcard.cpp
index d17c318b..4af60c63 100644
--- a/server/smartcard.cpp
+++ b/server/smartcard.cpp
@@ -137,25 +137,16 @@ RedCharDeviceSmartcard::read_one_msg_from_device()
         dev->priv->buf_pos = dev->priv->buf + remaining;
         dev->priv->buf_used = remaining;
         if (msg_to_client) {
-            return &msg_to_client->base;
+            if (dev->priv->scc) {
+                dev->priv->scc->pipe_add_push(&msg_to_client->base);
+            } else {
+                red_pipe_item_unref(&msg_to_client->base);
+            }
         }
     }
     return NULL;
 }
 
-/* this is called from both device input and client input. since the device is
- * a usb device, the context is still the main thread (kvm_main_loop, timers)
- * so no mutex is required. */
-void
-RedCharDeviceSmartcard::send_msg_to_client(RedPipeItem *msg, RedCharDeviceClientOpaque *opaque)
-{
-    SmartCardChannelClient *scc = (SmartCardChannelClient *) opaque;
-
-    spice_assert(priv->scc && priv->scc == scc);
-    red_pipe_item_ref(msg);
-    scc->pipe_add_push(msg);
-}
-
 void RedCharDeviceSmartcard::remove_client(RedCharDeviceClientOpaque *opaque)
 {
     SmartCardChannelClient *scc = (SmartCardChannelClient *) opaque;
diff --git a/server/smartcard.h b/server/smartcard.h
index 19ad349c..242413d7 100644
--- a/server/smartcard.h
+++ b/server/smartcard.h
@@ -35,7 +35,6 @@ protected:
     ~RedCharDeviceSmartcard();
 private:
     RedPipeItem* read_one_msg_from_device() override;
-    void send_msg_to_client(RedPipeItem *msg, RedCharDeviceClientOpaque *client) override;
     void remove_client(RedCharDeviceClientOpaque *client) override;
 public: // XXX make private
     red::unique_link<RedCharDeviceSmartcardPrivate> priv;


More information about the Spice-commits mailing list