add async_stagger reference for backported happy eyeballs open_connection
This commit is contained in:
parent
c4009e1c07
commit
923809ab43
2 changed files with 13 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
from ssl import SSLContext
|
from ssl import SSLContext
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
from asyncio import open_connection, StreamReader, StreamWriter
|
from asyncio import StreamReader, StreamWriter
|
||||||
|
from async_stagger import open_connection
|
||||||
|
|
||||||
from .interface import ITCPTransport, ITCPReader, ITCPWriter
|
from .interface import ITCPTransport, ITCPReader, ITCPWriter
|
||||||
from .security import tls_context
|
from .security import tls_context
|
||||||
|
@ -34,9 +35,15 @@ class TCPTransport(ITCPTransport):
|
||||||
if tls:
|
if tls:
|
||||||
cur_ssl = tls_context(tls_verify)
|
cur_ssl = tls_context(tls_verify)
|
||||||
|
|
||||||
|
local_addr: Optional[Tuple[str, int]] = None
|
||||||
|
if not bindhost is None:
|
||||||
|
local_addr = (bindhost, 53567)
|
||||||
|
|
||||||
reader, writer = await open_connection(
|
reader, writer = await open_connection(
|
||||||
hostname,
|
hostname,
|
||||||
port,
|
port,
|
||||||
ssl=cur_ssl,
|
server_hostname=hostname,
|
||||||
local_addr=(bindhost, 0))
|
ssl =cur_ssl,
|
||||||
|
local_addr =local_addr)
|
||||||
return (TCPReader(reader), TCPWriter(writer))
|
return (TCPReader(reader), TCPWriter(writer))
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,4 @@ anyio ==1.3.0
|
||||||
asyncio-throttle ==1.0.1
|
asyncio-throttle ==1.0.1
|
||||||
dataclasses ==0.6
|
dataclasses ==0.6
|
||||||
ircstates ==0.8.7
|
ircstates ==0.8.7
|
||||||
|
async_stagger ==0.3.0
|
||||||
|
|
Loading…
Reference in a new issue