mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
* src/ejabberd_s2s.erl: Fixed merge conflict (duplicate functions).
SVN Revision: 942
This commit is contained in:
parent
b3fb9d9100
commit
de63c622c2
@ -276,11 +276,11 @@ choose_connection(From, Connections) ->
|
|||||||
%El = lists:nth(random:uniform(length(Connections)), Connections),
|
%El = lists:nth(random:uniform(length(Connections)), Connections),
|
||||||
% use sticky connections based on the full JID of the sender
|
% use sticky connections based on the full JID of the sender
|
||||||
Pid = case lists:nth(erlang:phash(From, length(Connections)), Connections) of
|
Pid = case lists:nth(erlang:phash(From, length(Connections)), Connections) of
|
||||||
El when is_record(El, s2s) ->
|
El when is_record(El, s2s) ->
|
||||||
El#s2s.pid;
|
El#s2s.pid;
|
||||||
P when is_pid(P) ->
|
P when is_pid(P) ->
|
||||||
P
|
P
|
||||||
end,
|
end,
|
||||||
?ERROR_MSG("XXX using ejabberd_s2s_out ~p~n", [Pid]),
|
?ERROR_MSG("XXX using ejabberd_s2s_out ~p~n", [Pid]),
|
||||||
Pid.
|
Pid.
|
||||||
|
|
||||||
@ -288,37 +288,36 @@ choose_connection(From, Connections) ->
|
|||||||
new_connection(MyServer, Server, From, FromTo, Max_S2S_Connexions_Number) ->
|
new_connection(MyServer, Server, From, FromTo, Max_S2S_Connexions_Number) ->
|
||||||
Key = randoms:get_string(),
|
Key = randoms:get_string(),
|
||||||
{ok, Pid} = ejabberd_s2s_out:start(
|
{ok, Pid} = ejabberd_s2s_out:start(
|
||||||
MyServer, Server, {new, Key}),
|
MyServer, Server, {new, Key}),
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
case mnesia:read({s2s, FromTo}) of
|
case mnesia:read({s2s, FromTo}) of
|
||||||
L when length(L) < Max_S2S_Connexions_Number ->
|
L when length(L) < Max_S2S_Connexions_Number ->
|
||||||
mnesia:write(#s2s{fromto = FromTo,
|
mnesia:write(#s2s{fromto = FromTo,
|
||||||
pid = Pid,
|
pid = Pid,
|
||||||
key = Key}),
|
key = Key}),
|
||||||
?ERROR_MSG("XXX new s2s connection started ~p~n", [Pid]),
|
?ERROR_MSG("XXX new s2s connection started ~p~n", [Pid]),
|
||||||
Pid;
|
Pid;
|
||||||
L ->
|
L ->
|
||||||
choose_connection(From, L)
|
choose_connection(From, L)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
TRes = mnesia:transaction(F),
|
TRes = mnesia:transaction(F),
|
||||||
case TRes of
|
case TRes of
|
||||||
{atomic, Pid} ->
|
{atomic, Pid} ->
|
||||||
ejabberd_s2s_out:start_connection(Pid);
|
ejabberd_s2s_out:start_connection(Pid);
|
||||||
_ ->
|
_ ->
|
||||||
ejabberd_s2s_out:stop_connection(Pid)
|
ejabberd_s2s_out:stop_connection(Pid)
|
||||||
end,
|
end,
|
||||||
TRes.
|
TRes.
|
||||||
|
|
||||||
max_s2s_connexions_number(Host) ->
|
max_s2s_connexions_number(Host) ->
|
||||||
case ejabberd_config:get_local_option({max_s2s_connexions_number, Host}) of
|
case ejabberd_config:get_local_option({max_s2s_connexions_number, Host}) of
|
||||||
N when is_integer(N) ->
|
N when is_integer(N) ->
|
||||||
N;
|
N;
|
||||||
_ ->
|
_ ->
|
||||||
?DEFAULT_MAX_S2S_CONNEXIONS_NUMBER
|
?DEFAULT_MAX_S2S_CONNEXIONS_NUMBER
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Function: is_service(From, To) -> true | false
|
%% Function: is_service(From, To) -> true | false
|
||||||
%% Description: Return true if the destination must be considered as a
|
%% Description: Return true if the destination must be considered as a
|
||||||
|
Loading…
Reference in New Issue
Block a user