@@ -389,14 +389,24 @@ force_connection_event_refresh(Ref) ->
389
389
[rabbit_reader :force_event_refresh (C , Ref ) || C <- connections ()],
390
390
ok .
391
391
392
- handshake (Ref , ProxyProtocol ) ->
393
- case ProxyProtocol of
392
+ failed_to_recv_proxy_header (Ref , Error ) ->
393
+ Msg = case Error of
394
+ closed -> " error when receiving proxy header: TCP socket was ~p prematurely" ;
395
+ _Other -> " error when receiving proxy header: ~p "
396
+ end ,
397
+ rabbit_log :error (Msg , [Error ]),
398
+ % The following call will clean up resources then exit
399
+ _ = ranch :handshake (Ref ),
400
+ exit ({shutdown , failed_to_recv_proxy_header }).
401
+
402
+ handshake (Ref , ProxyProtocolEnabled ) ->
403
+ case ProxyProtocolEnabled of
394
404
true ->
395
- case ranch :recv_proxy_header (Ref , 1000 ) of
405
+ case ranch :recv_proxy_header (Ref , 3000 ) of
396
406
{error , Error } ->
397
- rabbit_log : error ( " error when receiving proxy header: ~p " , [ Error ]),
398
- % The following call will clean up resources then exit
399
- should_never_match = ranch : handshake (Ref );
407
+ failed_to_recv_proxy_header ( Ref , Error );
408
+ { error , protocol_error , Error } ->
409
+ failed_to_recv_proxy_header (Ref , Error );
400
410
{ok , ProxyInfo } ->
401
411
{ok , Sock } = ranch :handshake (Ref ),
402
412
setup_socket (Sock ),
0 commit comments