* src/ejabberd_s2s.erl: don't use the resource of the sender to choose

a s2s connection to ensure that a muc room always uses the same
connection

Merge branch 'ejabberd_s2s'

Conflicts:

.gitignore
src/configure
src/ejabberd_c2s.erl
src/ejabberd_s2s.erl

SVN Revision: 963
This commit is contained in:
Jérôme Sautret 2007-10-30 17:38:40 +00:00
parent 990514eef9
commit 96ded4535d
4 changed files with 66 additions and 60 deletions

6
.gitignore vendored
View File

@ -1,6 +1,12 @@
*.beam
*~
*.so
*.flc
*.log
erl_crash.dump
ejabberd.cfg
ejabberd.sh
Mnesia.*
Makefile
XmppAddr.asn1db
XmppAddr.erl

1
src/configure vendored
View File

@ -6871,4 +6871,3 @@ if test "$no_create" != yes; then
# would make configure fail if this is the last instruction.
$ac_cs_success || { (exit 1); exit 1; }
fi

View File

@ -980,7 +980,6 @@ code_change(_OldVsn, StateName, StateData, _Extra) ->
handle_info({send_text, Text}, StateName, StateData) ->
send_text(StateData, Text),
ejabberd_hooks:run(c2s_loop_debug, [Text]),
fsm_next_state(StateName, StateData);
handle_info(replaced, _StateName, StateData) ->
Lang = StateData#state.lang,

View File

@ -3,12 +3,12 @@
%%% Author : Alexey Shchepin <alexey@sevcom.net>
%%% Purpose : S2S connections manager
%%% Created : 7 Dec 2002 by Alexey Shchepin <alexey@sevcom.net>
%%% Id : $Id$
%%% Id : $Id: ejabberd_s2s.erl 820 2007-07-19 21:17:13Z mremond $
%%%----------------------------------------------------------------------
-module(ejabberd_s2s).
-author('alexey@sevcom.net').
-vsn('$Revision$ ').
-vsn('$Revision: 820 $ ').
-behaviour(gen_server).
@ -296,8 +296,11 @@ choose_pid(From, Pids) ->
[] -> Pids;
Ps -> Ps
end,
%% use sticky connections based on the full JID of the sender
Pid = lists:nth(erlang:phash(From, length(Pids1)), Pids1),
% Use sticky connections based on the JID of the sender (whithout
% the resource to ensure that a muc room always uses the same
% connection)
Pid = lists:nth(erlang:phash(jlib:jid_remove_resource(From), length(Pids1)),
Pids1),
?DEBUG("Using ejabberd_s2s_out ~p~n", [Pid]),
Pid.
@ -442,4 +445,3 @@ allow_host(MyServer, S2SHost) ->
_ -> true %% The default s2s policy is allow
end
end.