diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2018-05-14 23:12:40 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2018-05-23 10:33:05 +0100 |
commit | b17894e764a57e77537d0d450abf82ac0b6af9c6 (patch) | |
tree | 7d1842f30f442572a75fd5f400768982df7ca08f /python_modules | |
parent | e2f7a9235f111fa07b4978b1fe809087c4dcc2f4 (diff) |
Check for messages with duplicate values inside a channel
Make sure there are not 2 messages with the same value in the
same channel.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Diffstat (limited to 'python_modules')
-rw-r--r-- | python_modules/ptypes.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py index 916ba50..056e984 100644 --- a/python_modules/ptypes.py +++ b/python_modules/ptypes.py @@ -1028,6 +1028,10 @@ class ChannelType(Type): self.messages_byname = messages_byname.copy() self.count = 1 + self.messages_byvalue = {} + for m in self.messages: + self.messages_byvalue[m.value] = m + if self.base is None: server_info = MessagesInfo(True) client_info = MessagesInfo(False) @@ -1058,6 +1062,10 @@ class ChannelType(Type): if m.name in info.messages_byname: raise Exception("Duplicated message name '%s' in channel '%s'" % (m.name, self.name)) info.messages_byname[m.name] = m + if m.value in info.messages_byvalue: + raise Exception("Duplicated message value %d between '%s' and '%s' in channel '%s'" % ( + m.value, info.messages_byvalue[m.value].name, m.name, self.name)) + info.messages_byvalue[m.value] = m self.server_messages = server_info.messages self.server_messages_byname = server_info.messages_byname |