Fix None first_query and TcpClient.disconnect()

This commit is contained in:
Lonami Exo 2018-06-11 19:51:01 +02:00
parent f581db294a
commit 64dd957189
2 changed files with 3 additions and 2 deletions

View File

@ -84,8 +84,9 @@ class TcpClient:
"""Closes the connection."""
if self._socket is not None:
try:
self._socket.shutdown(socket.SHUT_RDWR)
self._socket.close()
except OSError:
pass
finally:
self._socket = None

View File

@ -215,7 +215,7 @@ class MTProtoSender:
__log__.debug('Connection success!')
if self.state.auth_key is None:
self._is_first_query = True
self._is_first_query = bool(self._first_query)
_last_error = SecurityError()
plain = MTProtoPlainSender(self._connection)
for retry in range(1, self._retries + 1):