Skip to content

Commit 313b287

Browse files
author
Konstantin Podshumok
committed
allow double call to client.disconnect()
1 parent 5ec7328 commit 313b287

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

smpplib/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ def disconnect(self):
8383
"""Disconnect from the SMSC"""
8484
logger.info('Disconnecting...')
8585

86-
self._socket.close()
86+
if self._socket is not None:
87+
self._socket.close()
88+
self._socket = None
8789
self.state = consts.SMPP_CLIENT_STATE_CLOSED
88-
self._socket = None
8990

9091
def _bind(self, command_name, **kwargs):
9192
"""Send bind_transmitter command to the SMSC"""

0 commit comments

Comments
 (0)