removed unnecessary gen_server call

SVN Revision: 2476
This commit is contained in:
Evgeniy Khramtsov 2009-08-13 09:59:31 +00:00
parent 1e148d4260
commit cbc78674e5
1 changed files with 6 additions and 12 deletions

View File

@ -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}.