aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2012-11-06 16:00:52 +0100
committerFredrik Gustafsson <[email protected]>2012-11-06 16:00:52 +0100
commit6291667b75dc66f57b1e00fed9aac356538b9ed9 (patch)
tree50eec586fe79b2bfba90d35af6d9682db177bfde /lib/inets
parenta94f7bd152a08a5d3fc43475f3fae7d886705b08 (diff)
downloadotp-6291667b75dc66f57b1e00fed9aac356538b9ed9.tar.gz
otp-6291667b75dc66f57b1e00fed9aac356538b9ed9.tar.bz2
otp-6291667b75dc66f57b1e00fed9aac356538b9ed9.zip
Changed to Bytes Per Second when checking clients rate, new options {byte_limit, integer()}
Diffstat (limited to 'lib/inets')
-rw-r--r--lib/inets/src/http_server/httpd_request_handler.erl18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl
index 0d584c70ae..73ccd74917 100644
--- a/lib/inets/src/http_server/httpd_request_handler.erl
+++ b/lib/inets/src/http_server/httpd_request_handler.erl
@@ -46,7 +46,7 @@
headers, %% #http_request_h{}
body, %% binary()
data, %% The total data received in bits, checked after 10s
- bit_limit %% Bit limit per second before kick out
+ byte_limit %% Bit limit per second before kick out
}).
%%====================================================================
@@ -144,7 +144,7 @@ continue_init(Manager, ConfigDB, SocketType, Socket, TimeOut) ->
?hdrt("set socket options (binary, packet & active)", []),
http_transport:setopts(SocketType, Socket,
[binary, {packet, 0}, {active, once}]),
- NewState = data_receive_counter(activate_request_timeout(State), httpd_util:lookup(ConfigDB, bit_limit, false)),
+ NewState = data_receive_counter(activate_request_timeout(State), httpd_util:lookup(ConfigDB, byte_limit, false)),
?hdrt("init done", []),
gen_server:enter_loop(?MODULE, [], NewState).
@@ -208,11 +208,11 @@ handle_info({Proto, Socket, Data},
%% case (catch Module:Function([Data | Args])) of
PROCESSED = (catch Module:Function([Data | Args])),
- NewDataSize = case State#state.bit_limit of
+ NewDataSize = case State#state.byte_limit of
undefined ->
undefined;
_ ->
- State#state.data + bit_size(Data)
+ State#state.data + byte_size(Data)
end,
?hdrt("data processed", [{processing_result, PROCESSED}]),
case PROCESSED of
@@ -277,8 +277,8 @@ handle_info(timeout, #state{mod = ModData} = State) ->
error_log("The client did not send the whole request before the "
"server side timeout", ModData),
{stop, normal, State#state{response_sent = true}};
-handle_info(check_data, #state{data = Data, bit_limit = Bit_Limit} = State) ->
- case Data >= (Bit_Limit * 10) of %% Ten seconds itnerval
+handle_info(check_data, #state{data = Data, byte_limit = Byte_Limit} = State) ->
+ case Data >= (Byte_Limit * 10) of %% Ten seconds itnerval
true ->
erlang:send_after(10000, self(), check_data),
{noreply, State#state{data = 0}};
@@ -626,13 +626,13 @@ activate_request_timeout(#state{timeout = Time} = State) ->
?hdrt("activate request timeout", [{time, Time}]),
Ref = erlang:send_after(Time, self(), timeout),
State#state{timer = Ref}.
-data_receive_counter(State, Bit_limit) ->
- case Bit_limit of
+data_receive_counter(State, Byte_limit) ->
+ case Byte_limit of
false ->
State#state{data = 0};
Nr ->
erlang:send_after(10000, self(), check_data),
- State#state{data = 0, bit_limit = Nr}
+ State#state{data = 0, byte_limit = Nr}
end.
cancel_request_timeout(#state{timer = undefined} = State) ->
State;