From a800ac5a4e7373f06360717f7a780814393b4fc9 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Mon, 15 Dec 2008 19:55:35 +0000 Subject: [PATCH] fix get_item_name deadlock on transaction SVN Revision: 1728 --- ChangeLog | 5 +++++ src/mod_pubsub/mod_pubsub.erl | 11 ++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index c535e951c..5fc7ac2f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-12-15 Christophe Romain + + * src/mod_pubsub/mod_pubsub.erl: fix get_item_name deadlock on + transaction + 2008-12-12 Alexey Shchepin * src/ejabberd_c2s.erl: Bugfix in "from" attribute checking diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index 5e0f14232..0306e331e 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -393,9 +393,10 @@ disco_sm_items(Acc, From, To, Node, _Lang) -> fun(#pubsub_item{itemid = Id}) -> %% "jid" is required by XEP-0030, and %% "node" is forbidden by XEP-0060. + {result, Name} = node_action(Host, Node, get_item_name, [Host, Node, Id]), {xmlelement, "item", [{"jid", jlib:jid_to_string(LJID)}, - {"name", get_item_name(Host, Node, Id)}], + {"name", Name}], []} end, AllItems), {result, NodeItems ++ Items} @@ -803,8 +804,9 @@ iq_disco_items(Host, Item, From) -> Items = lists:map( fun(#pubsub_item{itemid = {RN, _}}) -> SN = node_to_string(Node) ++ "!" ++ RN, + {result, Name} = node_call(Type, get_item_name, [Host, Node, RN]), {xmlelement, "item", [{"jid", Host}, {"node", SN}, - {"name", get_item_name(Host, Node, RN)}], []} + {"name", Name}], []} end, NodeItems), {result, Nodes ++ Items} end, @@ -2848,8 +2850,3 @@ uniqid() -> {T1, T2, T3} = now(), 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. -