Browse Source

Add strictly monotonic timestamp

pull/173/head
ncshaw 3 years ago
parent
commit
3e2b91933b
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      src/ibrowse_http_client.erl

+ 10
- 6
src/ibrowse_http_client.erl View File

@ -484,6 +484,15 @@ accumulate_response(Data, #state{reply_buffer = RepBuf,
State#state{reply_buffer = RepBuf_1}
end.
generate_timestamp() ->
case catch erlang:unique_integer([positive]) of
{'EXIT', _} ->
erlang:apply(erlang, now, []);
Unique ->
{A,B,C} = os:timestamp(),
{A * 1000000 + B, C, Unique}
end.
make_tmp_filename(true) ->
DownloadDir = ibrowse:get_config_value(download_dir, filename:absname("./")),
{A,B,C} = os:timestamp(),
@ -2050,12 +2059,7 @@ cancel_timer(Ref, {eat_message, Msg}) ->
end.
make_req_id() ->
case catch erlang:unique_integer() of
{'EXIT', _} ->
erlang:apply(erlang, now, []);
V ->
V
end.
generate_timestamp().
to_lower(Str) when is_binary(Str) ->
to_lower(binary_to_list(Str));

Loading…
Cancel
Save