mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-06 14:43:13 +03:00
Switch to blocking connect when using proxy (#1432)
Until a better fix is found, this should help proxy users.
This commit is contained in:
parent
c0e523508b
commit
79fb1a54cb
|
@ -65,7 +65,7 @@ class Connection(abc.ABC):
|
||||||
else:
|
else:
|
||||||
s.set_proxy(*self._proxy)
|
s.set_proxy(*self._proxy)
|
||||||
|
|
||||||
s.setblocking(False)
|
s.settimeout(timeout)
|
||||||
await asyncio.wait_for(
|
await asyncio.wait_for(
|
||||||
self._loop.sock_connect(s, address),
|
self._loop.sock_connect(s, address),
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
|
@ -78,14 +78,14 @@ class Connection(abc.ABC):
|
||||||
'without the SSL module being available'
|
'without the SSL module being available'
|
||||||
)
|
)
|
||||||
|
|
||||||
s.settimeout(timeout)
|
|
||||||
s = ssl_mod.wrap_socket(
|
s = ssl_mod.wrap_socket(
|
||||||
s,
|
s,
|
||||||
do_handshake_on_connect=True,
|
do_handshake_on_connect=True,
|
||||||
ssl_version=ssl_mod.PROTOCOL_SSLv23,
|
ssl_version=ssl_mod.PROTOCOL_SSLv23,
|
||||||
ciphers='ADH-AES256-SHA'
|
ciphers='ADH-AES256-SHA'
|
||||||
)
|
)
|
||||||
s.setblocking(False)
|
|
||||||
|
s.setblocking(False)
|
||||||
|
|
||||||
self._reader, self._writer = \
|
self._reader, self._writer = \
|
||||||
await asyncio.open_connection(sock=s, loop=self._loop)
|
await asyncio.open_connection(sock=s, loop=self._loop)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user