changeset 3138:d8a89a77d765

core (xmpp): raise InternalError when a new profile Client is created while there is already one in host
author Goffi <goffi@goffi.org>
date Wed, 29 Jan 2020 11:00:14 +0100
parents 559a625a236b
children ca61807f724c
files sat/core/xmpp.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/xmpp.py	Wed Jan 29 10:07:00 2020 +0100
+++ b/sat/core/xmpp.py	Wed Jan 29 11:00:14 2020 +0100
@@ -168,6 +168,9 @@
         password = yield host.memory.asyncGetParamA(
             "Password", "Connection", profile_key=profile
         )
+        if profile in host.profiles:
+            raise exceptions.InternalError(
+                f"There is already a profile of name {profile} in host")
         entity = host.profiles[profile] = cls(
             host, profile, jid.JID(host.memory.getParamA("JabberID", "Connection",
             profile_key=profile)), password,