Skip to content

Commit

Permalink
check if it is the same session
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Apr 2, 2024
1 parent 88d2453 commit a91f391
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/omero/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a91f391

Please sign in to comment.