summaryrefslogtreecommitdiff
path: root/lib/inets/src
diff options
context:
space:
mode:
authorJakub Witczak <kuba@erlang.org>2023-04-05 10:29:58 +0200
committerJakub Witczak <kuba@erlang.org>2023-04-20 12:37:35 +0200
commit2bf2e679214550f06163e475c6f4890a97bde40f (patch)
tree5534457690cbaaf2bb40cdf08c12588a9557caf1 /lib/inets/src
parent2e8c18646a001ea75fb3d15ddf3419105d7568d9 (diff)
downloaderlang-2bf2e679214550f06163e475c6f4890a97bde40f.tar.gz
inets: httpc fix for socket closing
- upon remote socket closure, add current request to only 1 queue
Diffstat (limited to 'lib/inets/src')
-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 c3185269f1..742c73536f 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),
@@ -327,8 +332,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,
@@ -338,8 +344,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);