Re: [PATCH spice-server v2] reds: Check we don't register a channel twice in reds_register_channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ack

On 3/19/19 4:11 PM, Frediano Ziglio wrote:
To avoid potential regressions, check it only if extra checks are
enabled.
This allows to check previous "Move channel registration to constructed
vfunc" commit.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
  server/reds.c | 8 ++++++++
  1 file changed, 8 insertions(+)

Changes since v1:
- add a warning in normal case

diff --git a/server/reds.c b/server/reds.c
index bc043764..14e5728b 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -380,6 +380,14 @@ void stat_remove_counter(SpiceServer *reds, RedStatCounter *counter)
  void reds_register_channel(RedsState *reds, RedChannel *channel)
  {
      spice_assert(reds);
+
+    uint32_t this_type, this_id;
+    g_object_get(channel, "channel-type", &this_type, "id", &this_id, NULL);
+    if (spice_extra_checks) {
+        g_assert(reds_find_channel(reds, this_type, this_id) == NULL);
+    } else {
+        g_warn_if_fail(reds_find_channel(reds, this_type, this_id) == NULL);
+    }
      reds->channels = g_list_prepend(reds->channels, channel);
      // create new channel in the client if possible
      main_channel_registered_new_channel(reds->main_channel, channel);
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]