Skip to content

Commit

Permalink
fix: Use the ping() result, not only the timeout signal
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol committed Feb 28, 2024
1 parent bfc4805 commit 488c479
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/callosum/lower/zeromq.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,11 @@ async def __aenter__(self) -> ZeroMQRPCConnection:
client_sock.connect(self.addr.uri)
self._main_sock = client_sock
self.transport._sock = client_sock
try:
await self.ping(
ping_timeout=int(self._handshake_timeout * 1000)
if self._handshake_timeout is not None
else 5000
)
except asyncio.TimeoutError:
if not await self.ping(
ping_timeout=int(self._handshake_timeout * 1000)
if self._handshake_timeout is not None
else 5000
):
raise AuthenticationError
handshake_done = time.perf_counter()
log.debug(
Expand Down

0 comments on commit 488c479

Please sign in to comment.