File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff 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 ),
You can’t perform that action at this time.
0 commit comments