@@ -2891,6 +2891,50 @@ async def client(addr, ctx):
2891
2891
# SSLProtocol should be DECREF to 0
2892
2892
self .assertIsNone (ctx ())
2893
2893
2894
+ def test_shutdown_timeout_handler_not_set (self ):
2895
+ loop = self .loop
2896
+
2897
+ def server (sock ):
2898
+ sslctx = self ._create_server_ssl_context (self .ONLYCERT ,
2899
+ self .ONLYKEY )
2900
+ sock = sslctx .wrap_socket (sock , server_side = True )
2901
+ sock .send (b'hello' )
2902
+ assert sock .recv (1024 ) == b'world'
2903
+ time .sleep (0.1 )
2904
+ sock .send (b'extra bytes' * 1 )
2905
+ # sending EOF here
2906
+ sock .shutdown (socket .SHUT_WR )
2907
+ # make sure we have enough time to reproduce the issue
2908
+ time .sleep (0.1 )
2909
+ sock .close ()
2910
+
2911
+ class Protocol (asyncio .Protocol ):
2912
+ def __init__ (self ):
2913
+ self .fut = asyncio .Future (loop = loop )
2914
+ self .transport = None
2915
+
2916
+ def connection_made (self , transport ):
2917
+ self .transport = transport
2918
+
2919
+ def data_received (self , data ):
2920
+ self .transport .write (b'world' )
2921
+ # pause reading would make incoming data stay in the sslobj
2922
+ self .transport .pause_reading ()
2923
+ # resume for AIO to pass
2924
+ loop .call_later (0.2 , self .transport .resume_reading )
2925
+
2926
+ def connection_lost (self , exc ):
2927
+ self .fut .set_result (None )
2928
+
2929
+ async def client (addr ):
2930
+ ctx = self ._create_client_ssl_context ()
2931
+ tr , pr = await loop .create_connection (Protocol , * addr , ssl = ctx )
2932
+ await pr .fut
2933
+ tr .close ()
2934
+
2935
+ with self .tcp_server (server ) as srv :
2936
+ loop .run_until_complete (client (srv .addr ))
2937
+
2894
2938
2895
2939
class Test_UV_TCPSSL (_TestSSL , tb .UVTestCase ):
2896
2940
pass
0 commit comments