File 7361-inets-refactor-code-to-improve-readability.patch of Package erlang
From 628a2b4b1738b1ccb385d164a62bb576d11b6de4 Mon Sep 17 00:00:00 2001
From: Kiko Fernandez-Reyes <kiko@erlang.org>
Date: Mon, 20 Feb 2023 15:48:42 +0100
Subject: [PATCH] inets: refactor code to improve readability
---
lib/inets/src/http_client/httpc_handler.erl | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 1868d9351a..6d4d198350 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -622,17 +622,12 @@ do_handle_info({ssl_closed, _}, State = #state{request = undefined}) ->
{stop, normal, State};
%%% Error cases
-do_handle_info({tcp_closed, _}, #state{session = #session{socket = Socket}=Session0} = State) ->
+do_handle_info({Closed, _}, #state{session = #session{socket = Socket}=Session0} = State)
+ when Closed == tcp_closed; Closed == ssl_closed ->
Session = Session0#session{socket = {remote_close, Socket}},
%% {stop, session_remotly_closed, State};
{stop, normal, State#state{session = Session}};
-do_handle_info({ssl_closed, _}, #state{session = #session{socket = Socket}=Session0} = State) ->
- Session = Session0#session{socket = {remote_close, Socket}},
- %% {stop, session_remotly_closed, State};
- {stop, normal, State#state{session = Session}};
-do_handle_info({tcp_error, _, _} = Reason, State) ->
- {stop, Reason, State};
-do_handle_info({ssl_error, _, _} = Reason, State) ->
+do_handle_info({Error, _, _} = Reason, State) when Error == tcp_error; Error == ssl_error ->
{stop, Reason, State};
%% Timeouts
--
2.35.3