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

fix get_item_name deadlock on transaction

SVN Revision: 1729
This commit is contained in:
Christophe Romain 2008-12-15 19:58:53 +00:00
parent f83fc51960
commit 96aaba738b
2 changed files with 9 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2008-12-15 Christophe Romain <cromain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: fix get_item_name deadlock on
transaction
2008-12-10 Jean-Sébastien Pédron <js.pedron@meetic-corp.com> 2008-12-10 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/eldap/eldap_utils.erl (case_insensitive_match/2): Replace * src/eldap/eldap_utils.erl (case_insensitive_match/2): Replace

View File

@ -393,9 +393,10 @@ disco_sm_items(Acc, From, To, Node, _Lang) ->
fun(#pubsub_item{itemid = Id}) -> fun(#pubsub_item{itemid = Id}) ->
%% "jid" is required by XEP-0030, and %% "jid" is required by XEP-0030, and
%% "node" is forbidden by XEP-0060. %% "node" is forbidden by XEP-0060.
{result, Name} = node_action(Host, Node, get_item_name, [Host, Node, Id]),
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(LJID)}, [#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(LJID)},
#xmlattr{name = 'name', value = get_item_name(Host, Node, Id)}]} #xmlattr{name = 'name', value = Name}]}
end, AllItems), end, AllItems),
{result, NodeItems ++ Items} {result, NodeItems ++ Items}
end. end.
@ -800,8 +801,9 @@ iq_disco_items(Host, Item, From) ->
Items = lists:map( Items = lists:map(
fun(#pubsub_item{itemid = {RN, _}}) -> fun(#pubsub_item{itemid = {RN, _}}) ->
SN = node_to_string(Node) ++ "!" ++ RN, SN = node_to_string(Node) ++ "!" ++ RN,
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [#xmlattr{name = 'jid', value = Host}, #xmlattr{name = 'node', value = SN}, #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [#xmlattr{name = 'jid', value = Host}, #xmlattr{name = 'node', value = SN},
#xmlattr{name = 'name', value = get_item_name(Host, Node, RN)}]} #xmlattr{name = 'name', value = Name}]}
end, NodeItems), end, NodeItems),
{result, Nodes ++ Items} {result, Nodes ++ Items}
end, end,
@ -2840,8 +2842,3 @@ uniqid() ->
{T1, T2, T3} = now(), {T1, T2, T3} = now(),
lists:flatten(io_lib:fwrite("~.16B~.16B~.16B", [T1, T2, T3])). lists:flatten(io_lib:fwrite("~.16B~.16B~.16B", [T1, T2, T3])).
%% @doc Return the name of a given node if available.
get_item_name(Host, Node, Id) ->
{result, Name} = node_action(Host, Node, get_item_name, [Host, Node, Id]),
Name.