mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +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()
|
self._lock = Lock()
|
||||||
|
|
||||||
def _recreate_socket(self):
|
def _recreate_socket(self):
|
||||||
self._socket = None
|
if self._proxy is None:
|
||||||
if self._proxy is not None:
|
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
else:
|
||||||
import socks
|
import socks
|
||||||
self._socket = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
|
self._socket = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self._socket.set_proxy(*self._proxy)
|
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):
|
def connect(self, ip, port):
|
||||||
"""Connects to the specified IP and port number"""
|
"""Connects to the specified IP and port number"""
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user