From a91f391ec2f957ab5c44839cd9395f7db8b73a8b Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Tue, 2 Apr 2024 16:02:25 +0100 Subject: [PATCH] check if it is the same session --- src/omero/gateway/__init__.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/omero/gateway/__init__.py b/src/omero/gateway/__init__.py index 6a8146228..31a03b5e7 100644 --- a/src/omero/gateway/__init__.py +++ b/src/omero/gateway/__init__.py @@ -2103,9 +2103,8 @@ def _resetOmeroClient(self): if self.c is not None: try: - if self.c.getSessionId() != self._sessionUuid: - self.c.__del__() - self.c = None + self.c.__del__() + self.c = None except omero.ClientError: # no session available pass @@ -2149,6 +2148,16 @@ def connect(self, sUuid=None): logger.debug("Ooops. no self._c") return False try: + if self.c is not None: + try: + sid = self.c.getSessionId() + # we have a session already from the client + if sUuid is None or sid == sUuid: + logger.debug('connected via client') + return True + except omero.ClientError: # no session available + pass + if self._sessionUuid is None and sUuid: self._sessionUuid = sUuid if self._sessionUuid is not None: