24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-14 22:00:16 +02:00

Optimize request processing

This commit is contained in:
Evgeniy Khramtsov 2014-05-01 23:58:05 +04:00
parent a1337cb73f
commit 58aa200297

View File

@ -131,6 +131,20 @@ request(Req, SIPSock, TrID, Action) ->
locate(_SIPMsg) -> locate(_SIPMsg) ->
ok. ok.
find(#uri{user = User, host = Host}) ->
LUser = jlib:nodeprep(User),
LServer = jlib:nameprep(Host),
if LUser == <<"">> ->
to_me;
true ->
case mod_sip_registrar:find_sockets(LUser, LServer) of
[] ->
not_found;
[_|_] ->
{relay, LServer}
end
end.
%%%=================================================================== %%%===================================================================
%%% Internal functions %%% Internal functions
%%%=================================================================== %%%===================================================================
@ -177,13 +191,7 @@ action(#sip{method = Method, hdrs = Hdrs, type = request} = Req, SIPSock) ->
true -> true ->
case at_my_host(ToURI) of case at_my_host(ToURI) of
true -> true ->
case ToURI#uri.user of find(ToURI);
<<"">> ->
to_me;
_ ->
LServer = jlib:nameprep(ToURI#uri.host),
{relay, LServer}
end;
false -> false ->
LServer = jlib:nameprep(FromURI#uri.host), LServer = jlib:nameprep(FromURI#uri.host),
{relay, LServer} {relay, LServer}
@ -194,13 +202,7 @@ action(#sip{method = Method, hdrs = Hdrs, type = request} = Req, SIPSock) ->
false -> false ->
case at_my_host(ToURI) of case at_my_host(ToURI) of
true -> true ->
case ToURI#uri.user of find(ToURI);
<<"">> ->
to_me;
_ ->
LServer = jlib:nameprep(ToURI#uri.host),
{relay, LServer}
end;
false -> false ->
deny deny
end end