From cbc78674e50eca00f09659312b80f0711595fa8b Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Thu, 13 Aug 2009 09:59:31 +0000 Subject: [PATCH] removed unnecessary gen_server call SVN Revision: 2476 --- src/ejabberd_local.erl | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/ejabberd_local.erl b/src/ejabberd_local.erl index 87ceabe0e..b0af736c0 100644 --- a/src/ejabberd_local.erl +++ b/src/ejabberd_local.erl @@ -134,10 +134,12 @@ route_iq(From, To, #iq{type = Type} = IQ, F) when is_function(F) -> end, ejabberd_router:route(From, To, Packet). -register_iq_response_handler(Host, ID, Module, Fun) -> - gen_server:call(ejabberd_local, - {register_iq_response_handler, - Host, ID, Module, Fun}). +register_iq_response_handler(_Host, ID, Module, Function) -> + TRef = erlang:start_timer(?IQ_TIMEOUT, ejabberd_local, ID), + mnesia:dirty_write(#iq_response{id = ID, + module = Module, + function = Function, + timer = TRef}). register_iq_handler(Host, XMLNS, Module, Fun) -> ejabberd_local ! {register_iq_handler, Host, XMLNS, Module, Fun}. @@ -195,14 +197,6 @@ init([]) -> %% {stop, Reason, State} %% Description: Handling call messages %%-------------------------------------------------------------------- -handle_call({register_iq_response_handler, _Host, - ID, Module, Function}, _From, State) -> - TRef = erlang:start_timer(?IQ_TIMEOUT, self(), ID), - mnesia:dirty_write(#iq_response{id = ID, - module = Module, - function = Function, - timer = TRef}), - {reply, ok, State}; handle_call(_Request, _From, State) -> Reply = ok, {reply, Reply, State}.