aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_client
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-01-04 17:59:23 +0100
committerMicael Karlberg <[email protected]>2012-01-04 17:59:23 +0100
commit345ffc04c94d583ec829bacf2807fe1562b7f72c (patch)
treeaf4fc5eebf1cd52f388c9c65a7e2f5df6631746a /lib/inets/src/http_client
parentbf5246974e426a18f0f12895b6696ddd32f876de (diff)
downloadotp-345ffc04c94d583ec829bacf2807fe1562b7f72c.tar.gz
otp-345ffc04c94d583ec829bacf2807fe1562b7f72c.tar.bz2
otp-345ffc04c94d583ec829bacf2807fe1562b7f72c.zip
[inets/httpc] Add test case
Add a test case verifying the session selection. Add some more use of the update_session function. Improved verbosity printouts. OTP-9847
Diffstat (limited to 'lib/inets/src/http_client')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl18
-rw-r--r--lib/inets/src/http_client/httpc_manager.erl2
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 8874304bd6..a88945898a 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -1181,7 +1181,7 @@ handle_pipeline(#state{status = pipeline,
case queue:out(State#state.pipeline) of
{empty, _} ->
- ?hcrd("epmty pipeline queue", []),
+ ?hcrd("pipeline queue empty", []),
%% The server may choose too teminate an idle pipeline
%% in this case we want to receive the close message
@@ -1191,9 +1191,10 @@ handle_pipeline(#state{status = pipeline,
%% If a pipeline that has been idle for some time is not
%% closed by the server, the client may want to close it.
- NewState = activate_queue_timeout(TimeOut, State),
- NewSession = Session#session{queue_length = 0},
- httpc_manager:insert_session(NewSession, ProfileName),
+ NewState = activate_queue_timeout(TimeOut, State),
+ httpc_manager:update_session(ProfileName,
+ Session#session.id,
+ #session.queue_length, 0),
%% Note mfa will be initilized when a new request
%% arrives.
{noreply,
@@ -1203,6 +1204,7 @@ handle_pipeline(#state{status = pipeline,
headers = undefined,
body = undefined}};
{{value, NextRequest}, Pipeline} ->
+ ?hcrd("pipeline queue non-empty", []),
case lists:member(NextRequest#request.id,
State#state.canceled) of
true ->
@@ -1257,7 +1259,7 @@ handle_keep_alive_queue(
case queue:out(State#state.keep_alive) of
{empty, _} ->
- ?hcrd("empty keep_alive queue", []),
+ ?hcrd("keep_alive queue empty", []),
%% The server may choose too terminate an idle keep_alive session
%% in this case we want to receive the close message
%% at once and not when trying to send the next
@@ -1266,8 +1268,9 @@ handle_keep_alive_queue(
%% If a keep_alive session has been idle for some time is not
%% closed by the server, the client may want to close it.
NewState = activate_queue_timeout(TimeOut, State),
- NewSession = Session#session{queue_length = 0},
- httpc_manager:insert_session(NewSession, ProfileName),
+ httpc_manager:update_session(ProfileName,
+ Session#session.id,
+ #session.queue_length, 0),
%% Note mfa will be initilized when a new request
%% arrives.
{noreply,
@@ -1279,6 +1282,7 @@ handle_keep_alive_queue(
}
};
{{value, NextRequest}, KeepAlive} ->
+ ?hcrd("keep_alive queue non-empty", []),
case lists:member(NextRequest#request.id,
State#state.canceled) of
true ->
diff --git a/lib/inets/src/http_client/httpc_manager.erl b/lib/inets/src/http_client/httpc_manager.erl
index d699f1e7d8..4262abc5d0 100644
--- a/lib/inets/src/http_client/httpc_manager.erl
+++ b/lib/inets/src/http_client/httpc_manager.erl
@@ -206,7 +206,7 @@ insert_session(Session, ProfileName) ->
update_session(ProfileName, SessionId, Pos, Value) ->
SessionDbName = session_db_name(ProfileName),
- ?hcrt("insert session",
+ ?hcrt("update session",
[{id, SessionId},
{pos, Pos},
{value, Value},