Skip to content

Commit 293b698

Browse files
committed
a fix
1 parent bf68987 commit 293b698

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/test_tls.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,11 @@ async def main() -> str:
258258
class ServerProtocol(asyncio.Protocol):
259259
def __init__(self) -> None:
260260
self.upgraded: asyncio.Future[None] = loop.create_future()
261+
self.connected = asyncio.Event()
261262

262263
def connection_made(self, transport: asyncio.BaseTransport) -> None:
263264
self.transport = transport
265+
self.connected.set()
264266
if not isinstance(
265267
transport.get_extra_info("sslcontext"), type(None)
266268
):
@@ -321,6 +323,7 @@ def server_factory() -> ServerProtocol:
321323
)
322324
while not server_protocols:
323325
await asyncio.sleep(0.01)
326+
await asyncio.wait_for(server_protocols[0].connected.wait(), 5.0)
324327
await asyncio.gather(
325328
server_protocols[0].upgrade(server_ctx),
326329
client_protocol.upgrade(client_ctx),

0 commit comments

Comments
 (0)