Skip to content

Commit

Permalink
fix closing conn if closed
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveicedgreentea committed Jan 20, 2023
1 parent 2023a9c commit 9b9f3b0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions madvr/madvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,18 @@ def _clear_attr(self) -> None:

def close_connection(self) -> None:
"""close the connection"""
self.client.close()
self.notification_client.close()
try:
self.client.close()
except AttributeError:
# means its already closed
pass

try:
self.notification_client.close()
except AttributeError:
# means its already closed
pass

self.is_closed = True

# Clear attr
Expand Down

0 comments on commit 9b9f3b0

Please sign in to comment.