@@ -497,14 +497,6 @@ def test_start_tls_server_1(self):
497497
498498 server_context = test_utils .simple_server_sslcontext ()
499499 client_context = test_utils .simple_client_sslcontext ()
500- if (sys .platform .startswith ('freebsd' )
501- or sys .platform .startswith ('win' )
502- or sys .platform .startswith ('darwin' )):
503- # bpo-35031: Some FreeBSD and Windows buildbots fail to run this test
504- # as the eof was not being received by the server if the payload
505- # size is not big enough. This behaviour only appears if the
506- # client is using TLS1.3. Also seen on macOS.
507- client_context .options |= ssl .OP_NO_TLSv1_3
508500 answer = None
509501
510502 def client (sock , addr ):
@@ -521,9 +513,10 @@ def client(sock, addr):
521513 sock .close ()
522514
523515 class ServerProto (asyncio .Protocol ):
524- def __init__ (self , on_con , on_con_lost ):
516+ def __init__ (self , on_con , on_con_lost , on_got_hello ):
525517 self .on_con = on_con
526518 self .on_con_lost = on_con_lost
519+ self .on_got_hello = on_got_hello
527520 self .data = b''
528521 self .transport = None
529522
@@ -537,7 +530,7 @@ def replace_transport(self, tr):
537530 def data_received (self , data ):
538531 self .data += data
539532 if len (self .data ) >= len (HELLO_MSG ):
540- self .transport . write ( ANSWER )
533+ self .on_got_hello . set_result ( None )
541534
542535 def connection_lost (self , exc ):
543536 self .transport = None
@@ -546,7 +539,7 @@ def connection_lost(self, exc):
546539 else :
547540 self .on_con_lost .set_exception (exc )
548541
549- async def main (proto , on_con , on_con_lost ):
542+ async def main (proto , on_con , on_con_lost , on_got_hello ):
550543 tr = await on_con
551544 tr .write (HELLO_MSG )
552545
@@ -556,17 +549,20 @@ async def main(proto, on_con, on_con_lost):
556549 tr , proto , server_context ,
557550 server_side = True ,
558551 ssl_handshake_timeout = self .TIMEOUT )
559-
560552 proto .replace_transport (new_tr )
561553
554+ await on_got_hello
555+ new_tr .write (ANSWER )
556+
562557 await on_con_lost
563558 self .assertEqual (proto .data , HELLO_MSG )
564559 new_tr .close ()
565560
566561 async def run_main ():
567562 on_con = self .loop .create_future ()
568563 on_con_lost = self .loop .create_future ()
569- proto = ServerProto (on_con , on_con_lost )
564+ on_got_hello = self .loop .create_future ()
565+ proto = ServerProto (on_con , on_con_lost , on_got_hello )
570566
571567 server = await self .loop .create_server (
572568 lambda : proto , '127.0.0.1' , 0 )
@@ -575,7 +571,7 @@ async def run_main():
575571 with self .tcp_client (lambda sock : client (sock , addr ),
576572 timeout = self .TIMEOUT ):
577573 await asyncio .wait_for (
578- main (proto , on_con , on_con_lost ),
574+ main (proto , on_con , on_con_lost , on_got_hello ),
579575 timeout = self .TIMEOUT )
580576
581577 server .close ()
0 commit comments