25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

* src/ejabberd_s2s_out.erl: Bugfix

SVN Revision: 976
This commit is contained in:
Alexey Shchepin 2007-11-25 16:14:32 +00:00
parent 65a7bb7d2a
commit 950060cd3c
2 changed files with 17 additions and 15 deletions

View File

@ -1,5 +1,7 @@
2007-11-25 Alexey Shchepin <alexey@process-one.net>
* src/ejabberd_s2s_out.erl: Bugfix
* src/ejabberd_sm.erl: Optimized check_max_sessions (thanks to
Christophe Romain)

View File

@ -101,7 +101,7 @@ start(From, Host, Type) ->
start_link(From, Host, Type) ->
p1_fsm:start_link(ejabberd_s2s_out, [From, Host, Type],
?FSMLIMITS ++ ?FSMOPTS).
?FSMLIMITS ++ ?FSMOPTS).
start_connection(Pid) ->
p1_fsm:send_event(Pid, init).
@ -165,9 +165,9 @@ open_socket(init, StateData) ->
StateData#state.myname,
StateData#state.server),
?DEBUG("open_socket: ~p", [{StateData#state.myname,
StateData#state.server,
StateData#state.new,
StateData#state.verify}]),
StateData#state.server,
StateData#state.new,
StateData#state.verify}]),
AddrList = case idna:domain_utf8_to_ascii(StateData#state.server) of
false -> [];
ASCIIAddr ->
@ -789,10 +789,16 @@ send_queue(StateData, Q) ->
%% Bounce a single message (xmlelement)
bounce_element(El, Error) ->
Err = jlib:make_error_reply(El, Error),
From = jlib:string_to_jid(xml:get_tag_attr_s("from", El)),
To = jlib:string_to_jid(xml:get_tag_attr_s("to", El)),
ejabberd_router:route(To, From, Err).
{xmlelement, _Name, Attrs, _SubTags} = El,
case xml:get_attr_s("type", Attrs) of
"error" -> ok;
"result" -> ok;
_ ->
Err = jlib:make_error_reply(El, Error),
From = jlib:string_to_jid(xml:get_tag_attr_s("from", El)),
To = jlib:string_to_jid(xml:get_tag_attr_s("to", El)),
ejabberd_router:route(To, From, Err)
end.
bounce_queue(Q, Error) ->
case queue:out(Q) of
@ -818,13 +824,7 @@ cancel_timer(Timer) ->
bounce_messages(Error) ->
receive
{send_element, El} ->
{xmlelement, _Name, Attrs, _SubTags} = El,
case xml:get_attr_s("type", Attrs) of
"error" ->
ok;
_ ->
bounce_element(El, Error)
end,
bounce_element(El, Error),
bounce_messages(Error)
after 0 ->
ok