summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErlang/OTP <otp@erlang.org>2023-04-25 17:09:00 +0200
committerErlang/OTP <otp@erlang.org>2023-04-25 17:09:00 +0200
commit3427ff192d1503362d86b3a588574593b3366496 (patch)
treefda311839c1c680d4a9a5ad1df20427d95bcab2e
parente3c8666786fa4ba705ebc7d36f722cdc34736a5c (diff)
parentfadd337c262833387f285519b76d1b3ef3d4c0a7 (diff)
downloaderlang-3427ff192d1503362d86b3a588574593b3366496.tar.gz
Merge branch 'kuba/maint-24/inets/fix_httpc_remote_socket_close/OTP-18545' into maint-25
* kuba/maint-24/inets/fix_httpc_remote_socket_close/OTP-18545: inets: httpc fix for socket closing
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index b7b8dd7055..2dee200291 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -305,8 +305,9 @@ terminate(normal,
%% Socket closed remotely
terminate(normal,
#state{session = #session{socket = {remote_close, Socket},
- socket_type = SocketType,
- id = Id},
+ socket_type = SocketType,
+ type = Type,
+ id = Id},
profile_name = ProfileName,
request = Request,
timers = Timers,
@@ -315,8 +316,12 @@ terminate(normal,
%% Clobber session
(catch httpc_manager:delete_session(Id, ProfileName)),
- maybe_retry_queue(Pipeline, State),
- maybe_retry_queue(KeepAlive, State),
+ case Type of
+ pipeline ->
+ maybe_retry_queue(Pipeline, State);
+ _ ->
+ maybe_retry_queue(KeepAlive, State)
+ end,
%% Cancel timers
cancel_timers(Timers),
@@ -328,8 +333,9 @@ terminate(normal,
http_transport:close(SocketType, Socket);
terminate(_Reason, #state{session = #session{id = Id,
- socket = Socket,
- socket_type = SocketType},
+ socket = Socket,
+ type = Type,
+ socket_type = SocketType},
request = undefined,
profile_name = ProfileName,
timers = Timers,
@@ -339,8 +345,12 @@ terminate(_Reason, #state{session = #session{id = Id,
%% Clobber session
(catch httpc_manager:delete_session(Id, ProfileName)),
- maybe_retry_queue(Pipeline, State),
- maybe_retry_queue(KeepAlive, State),
+ case Type of
+ pipeline ->
+ maybe_retry_queue(Pipeline, State);
+ _ ->
+ maybe_retry_queue(KeepAlive, State)
+ end,
cancel_timer(Timers#timers.queue_timer, timeout_queue),
http_transport:close(SocketType, Socket);