mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Tidy if/else branch on _recreate_socket
This commit is contained in:
parent
2399b7e55e
commit
d321096714
|
@ -20,15 +20,13 @@ class TcpClient:
|
|||
self._lock = Lock()
|
||||
|
||||
def _recreate_socket(self):
|
||||
self._socket = None
|
||||
if self._proxy is not None:
|
||||
if self._proxy is None:
|
||||
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
else:
|
||||
import socks
|
||||
self._socket = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self._socket.set_proxy(*self._proxy)
|
||||
|
||||
if not self._socket:
|
||||
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
def connect(self, ip, port):
|
||||
"""Connects to the specified IP and port number"""
|
||||
if not self.connected:
|
||||
|
|
Loading…
Reference in New Issue
Block a user