From da0499d75344aae8102f9c1c349b79f1c4875e38 Mon Sep 17 00:00:00 2001 From: Tayler Porter Date: Sun, 10 Apr 2022 22:43:36 -0500 Subject: [PATCH] [FIX] Made SIPClient.stop even more reliable. --- pyVoIP/SIP.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pyVoIP/SIP.py b/pyVoIP/SIP.py index 41cdb8e..aeac0d2 100644 --- a/pyVoIP/SIP.py +++ b/pyVoIP/SIP.py @@ -589,10 +589,12 @@ def stop(self): self._close_sockets() def _close_sockets(self): - if self.s: - self.s.close() - if self.out: - self.out.close() + if hasattr(self, 's'): + if self.s: + self.s.close() + if hasattr(self, 'out'): + if self.out: + self.out.close() def genCallID(self): return hashlib.sha256(str(self.callID.next()).encode('utf8')).hexdigest()[0:32]+"@"+self.myIP+":"+str(self.myPort)