瀏覽代碼

Removed unnecessary pipeline size from con state

Tracking size in http connection process state
was unnecessary as it wasn't queried for logic
or obvious reporting and ets table should have
right (within 1) value already.
pull/123/head
benjaminplee 10 年之前
父節點
當前提交
c14e322599
共有 1 個文件被更改,包括 6 次插入9 次删除
  1. +6
    -9
      src/ibrowse_http_client.erl

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

@ -53,7 +53,7 @@
deleted_crlf = false, transfer_encoding, deleted_crlf = false, transfer_encoding,
chunk_size, chunk_size_buffer = <<>>, chunk_size, chunk_size_buffer = <<>>,
recvd_chunk_size, interim_reply_sent = false, recvd_chunk_size, interim_reply_sent = false,
lb_ets_tid, cur_pipeline_size = 0, prev_req_id
lb_ets_tid, prev_req_id
}). }).
-record(request, {url, method, options, from, -record(request, {url, method, options, from,
@ -1938,18 +1938,16 @@ to_lower([], Acc) ->
shutting_down(#state{lb_ets_tid = undefined}) -> shutting_down(#state{lb_ets_tid = undefined}) ->
ok; ok;
shutting_down(#state{lb_ets_tid = Tid,
cur_pipeline_size = _Sz}) ->
shutting_down(#state{lb_ets_tid = Tid}) ->
catch ets:delete(Tid, self()). catch ets:delete(Tid, self()).
inc_pipeline_counter(#state{is_closing = true} = State) -> inc_pipeline_counter(#state{is_closing = true} = State) ->
State; State;
inc_pipeline_counter(#state{lb_ets_tid = undefined} = State) -> inc_pipeline_counter(#state{lb_ets_tid = undefined} = State) ->
State; State;
inc_pipeline_counter(#state{cur_pipeline_size = Pipe_sz,
lb_ets_tid = Tid} = State) ->
inc_pipeline_counter(#state{lb_ets_tid = Tid} = State) ->
update_counter(Tid, self(), {2,1,99999,9999}), update_counter(Tid, self(), {2,1,99999,9999}),
State#state{cur_pipeline_size = Pipe_sz + 1}.
State.
update_counter(Tid, Key, Args) -> update_counter(Tid, Key, Args) ->
ets:update_counter(Tid, Key, Args). ets:update_counter(Tid, Key, Args).
@ -1958,8 +1956,7 @@ dec_pipeline_counter(#state{is_closing = true} = State) ->
State; State;
dec_pipeline_counter(#state{lb_ets_tid = undefined} = State) -> dec_pipeline_counter(#state{lb_ets_tid = undefined} = State) ->
State; State;
dec_pipeline_counter(#state{cur_pipeline_size = Pipe_sz,
lb_ets_tid = Tid} = State) ->
dec_pipeline_counter(#state{lb_ets_tid = Tid} = State) ->
_ = try _ = try
update_counter(Tid, self(), {2,-1,0,0}), update_counter(Tid, self(), {2,-1,0,0}),
update_counter(Tid, self(), {3,-1,0,0}) update_counter(Tid, self(), {3,-1,0,0})
@ -1967,7 +1964,7 @@ dec_pipeline_counter(#state{cur_pipeline_size = Pipe_sz,
_:_ -> _:_ ->
ok ok
end, end,
State#state{cur_pipeline_size = Pipe_sz - 1}.
State.
flatten([H | _] = L) when is_integer(H) -> flatten([H | _] = L) when is_integer(H) ->
L; L;

Loading…
取消
儲存