浏览代码

Add strictly monotonic timestamp

pull/173/head
ncshaw 3 年前
父节点
当前提交
3e2b91933b
共有 1 个文件被更改,包括 10 次插入6 次删除
  1. +10
    -6
      src/ibrowse_http_client.erl

+ 10
- 6
src/ibrowse_http_client.erl 查看文件

@ -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));

正在加载...
取消
保存