aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2014-12-10 10:42:55 +0100
committerIngela Anderton Andin <[email protected]>2014-12-10 10:42:55 +0100
commit3ed99869e4b3896f2d1d2ea56208bba4537129a8 (patch)
treec6f240993862c24a2b08a98d34ae99faca217bd3 /lib/inets/src
parent74ffce8cece28b9478dbace16346609e233cff70 (diff)
parent6f05b71163cb08aac06b2ad1dfaa70c752cc04e5 (diff)
downloadotp-3ed99869e4b3896f2d1d2ea56208bba4537129a8.tar.gz
otp-3ed99869e4b3896f2d1d2ea56208bba4537129a8.tar.bz2
otp-3ed99869e4b3896f2d1d2ea56208bba4537129a8.zip
Merge branch 'ia/scrapinghub/closing_httpc_handler_on_closed_while_send'
* ia/scrapinghub/closing_httpc_handler_on_closed_while_send: inets: Fix typo inets: stop httpc_handler on 'connection closed' send error
Diffstat (limited to 'lib/inets/src')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 0a42e7210c..7f7328f1d9 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -316,8 +316,9 @@ handle_call(#request{address = Addr} = Request, _,
{reply, ok, State}
end;
{error, Reason} ->
- ?hcri("failed sending request", [{reason, Reason}]),
- {reply, {pipeline_failed, Reason}, State0}
+ ?hcri("failed sending request", [{reason, Reason}]),
+ NewPipeline = queue:in(Request, State0#state.pipeline),
+ {stop, shutdown, {pipeline_failed, Reason}, State0#state{pipeline = NewPipeline}}
end;
handle_call(#request{address = Addr} = Request, _,
@@ -355,25 +356,25 @@ handle_call(#request{address = Addr} = Request, _,
?hcrd("no current request", []),
cancel_timer(Timers#timers.queue_timer,
timeout_queue),
+ NewTimers = Timers#timers{queue_timer = undefined},
+ State1 = State0#state{timers = NewTimers},
Address = handle_proxy(Addr, Proxy),
case httpc_request:send(Address, Session, Request) of
ok ->
?hcrd("request sent", []),
%% Activate the request time out for the new request
- State1 =
- activate_request_timeout(State0#state{request = Request}),
- NewTimers = State1#state.timers,
+ State2 =
+ activate_request_timeout(State1#state{request = Request}),
NewSession =
Session#session{queue_length = 1,
client_close = ClientClose},
insert_session(NewSession, ProfileName),
- State = init_wait_for_response_state(Request, State1#state{session = NewSession,
- timers = NewTimers}),
+ State = init_wait_for_response_state(Request, State2#state{session = NewSession}),
{reply, ok, State};
{error, Reason} ->
?hcri("failed sending request", [{reason, Reason}]),
- {reply, {request_failed, Reason}, State0}
+ {stop, shutdown, {keepalive_failed, Reason}, State1}
end
end;
@@ -1329,7 +1330,7 @@ handle_keep_alive_queue(#state{status = keep_alive,
Session, <<>>,
State#state{keep_alive = KeepAlive});
{error, Reason} ->
- {reply, {keep_alive_failed, Reason}, State}
+ {stop, shutdown, {keepalive_failed, Reason}, State}
end
end
end.