Skip to content

Commit

Permalink
Fix error when stop() is called on certain conditions (#70)
Browse files Browse the repository at this point in the history
Fixes:
  AttributeError: "'NoneType' object has no attribute 'join'"

when calling stop and not connected (invalid password, fs is not running)
  • Loading branch information
iuridiniz authored May 19, 2021
1 parent 8c553bf commit ec5d8e2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions greenswitch/esl.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,12 @@ def stop(self):
except (NotConnectedError, socket.error):
pass
self._run = False
logging.info("Waiting for receive greenlet exit")
self._receive_events_greenlet.join()
logging.info("Waiting for event processing greenlet exit")
self._process_events_greenlet.join()
if self._receive_events_greenlet:
logging.info("Waiting for receive greenlet exit")
self._receive_events_greenlet.join()
if self._process_events_greenlet:
logging.info("Waiting for event processing greenlet exit")
self._process_events_greenlet.join()
self.sock.close()
self.sock_file.close()

Expand Down

0 comments on commit ec5d8e2

Please sign in to comment.