Created
May 19, 2011 20:27
-
-
Save lpgauth/981654 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%-------------------------------------------------------------------- | |
%%% Internal functions | |
%%-------------------------------------------------------------------- | |
find_best_connection(Tid, Max_pipe) -> | |
case ets:first(Tid) of | |
{Cur_sz, Pid} when Cur_sz < Max_pipe -> | |
ets:delete(Tid, {Cur_sz, Pid}), | |
ets:insert(Tid, {{Cur_sz + 1, Pid}, []}), | |
{ok, Pid}; | |
_ -> | |
{error, retry_later} | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment