Skip to content

Commit

Permalink
try #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Dec 9, 2022
1 parent 03e5c10 commit d46e5d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pymodbus/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,18 +314,20 @@ def connection_made(self, transport):
async def close(self): # pylint: disable=invalid-overridden-method
"""Close connection."""
if self.transport:
_logger.debug("--> JAN: closing transport")
self.transport.close()
_logger.debug("--> JAN: closed transport")
while self.transport is not None:
if self.transport.is_closing():
_logger.debug("Waiting for transport close.")
await asyncio.sleep(0.1)
_logger.debug("--> JAN: done transport")
self._connected = False

def connection_lost(self, reason):
"""Call when the connection is lost or closed.
The argument is either an exception object or None
"""
_logger.debug("--> JAN connection_lost called!")
self._connection_lost(reason)

if self.factory:
Expand Down

0 comments on commit d46e5d1

Please sign in to comment.