Переглянути джерело

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.

Завантаження…
Відмінити
Зберегти