Skip to content

Commit

Permalink
Improve status checks before closing underlying connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoretti committed Nov 3, 2023
1 parent 500fc32 commit dc3a230
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions exasol/driver/websocket/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ def connection(self):

def close(self):
"""See also :py:meth: `Connection.close`"""
if not self._connection:
connection_to_close = self._connection
self._connection = None
if connection_to_close is None or connection_to_close.is_closed:
return
try:
self._connection.close()
connection_to_close.close()
except Exception as ex:
raise Error() from ex

Expand Down

0 comments on commit dc3a230

Please sign in to comment.