Skip to content

Commit

Permalink
Merge pull request #77 from fermi-ad/pull-request
Browse files Browse the repository at this point in the history
Pull request
  • Loading branch information
rneswold authored Feb 7, 2024
2 parents 03d00d8 + fb54eb0 commit 325dea0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
33 changes: 20 additions & 13 deletions acsys/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,23 +426,30 @@ async def _connect(self, proto):
self._raw_handle = res[3]
self.handle = Connection.__rtoa(res[3])
_log.info('connected to ACSys with handle %s', self.handle)
else:
raise sts

return sts

@staticmethod
async def create():
proto = await _create_socket()
if proto is not None:
con = Connection()
try:
await con._connect(proto)
return con
except:
tries_left = 3

# Our proxy can return a connection to a broken ACNET
# service. Rather than have the user's script fail, we'll
# retry the connection to pick the next machine. If all are
# bad, then we don't want to infinitely loop, so there is a
# limit.

while tries_left > 0:
proto = await _create_socket()
if proto is not None:
con = Connection()
if (await con._connect(proto)).isSuccess:
return con
del con
raise
else:
_log.error('*** unable to connect to ACSys')
raise ACNET_DISCONNECTED
tries_left -= 1
_log.debug('detected bad connection ... retrying')
_log.error('*** unable to connect to ACSys')
raise ACNET_DISCONNECTED

async def get_name(self, addr):
"""Look-up node name.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="acsys",
version="0.12.6",
version="0.12.7",
author="Rich Neswold",
author_email="[email protected]",
description="ACSys Client library",
Expand Down

0 comments on commit 325dea0

Please sign in to comment.