[Spice-devel] [PATCH spice-common 3/4] Check for messages with duplicate names inside a channel

Frediano Ziglio fziglio at redhat.com
Mon May 14 22:18:53 UTC 2018


Make sure there are not 2 messages with the same name in the
same channel.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 python_modules/ptypes.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
index ef580aa..664dd1d 100644
--- a/python_modules/ptypes.py
+++ b/python_modules/ptypes.py
@@ -1055,6 +1055,9 @@ class ChannelType(Type):
                     m.value = info.count
                 info.count = m.value + 1
                 info.messages.append(m)
+                if m.name in info.messages_byname:
+                    raise Exception("Duplicated message name between %s and %s in channel %s" % (
+                        info.messages_byname[m.name].name, m.name, self.name))
                 info.messages_byname[m.name] = m
 
         self.server_messages = server_info.messages
-- 
2.17.0



More information about the Spice-devel mailing list