浏览代码

Merge pull request #83 from maruthavanan/master

Update counter crashed when select process shutdown.
pull/85/head
Chandrashekhar Mullaparthi 12 年前
父节点
当前提交
76692df488
共有 1 个文件被更改,包括 10 次插入3 次删除
  1. +10
    -3
      src/ibrowse_lb.erl

+ 10
- 3
src/ibrowse_lb.erl 查看文件

@ -231,7 +231,9 @@ code_change(_OldVsn, State, _Extra) ->
%%% Internal functions
%%--------------------------------------------------------------------
find_best_connection(Tid, Max_pipe) ->
ets:safe_fixtable(Tid, true),
Res = find_best_connection(ets:first(Tid), Tid, Max_pipe),
ets:safe_fixtable(Tid, false),
Res.
find_best_connection('$end_of_table', _, _) ->
@ -240,9 +242,14 @@ find_best_connection(Pid, Tid, Max_pipe) ->
case ets:lookup(Tid, Pid) of
[{Pid, Cur_sz, Speculative_sz}] when Cur_sz < Max_pipe,
Speculative_sz < Max_pipe ->
ets:update_counter(Tid, Pid, {3, 1, 9999999, 9999999}),
{ok, Pid};
_ ->
case catch ets:update_counter(Tid, Pid, {3, 1, 9999999, 9999999}) of
{'EXIT', _} ->
%% The selected process has shutdown
find_best_connection(ets:next(Tid, Pid), Tid, Max_pipe);
_ ->
{ok, Pid}
end;
_ ->
find_best_connection(ets:next(Tid, Pid), Tid, Max_pipe)
end.

正在加载...
取消
保存