./ct_report/coverage/mongoose_router_dynamic_domains.COVER.html

1 %%%-------------------------------------------------------------------
2 %%% @doc
3 %%% this router should be tried in the very end, but before s2s.
4 %%% it checks if destination domain is configured dynamically,
5 %%% if it is so - the router adds domain to the routing table,
6 %%% and retries local routing.
7 %%%
8 %%% this ensures lazy dynamic domains registration in the routing
9 %%% table.
10 %%% @end
11 %%%-------------------------------------------------------------------
12 -module(mongoose_router_dynamic_domains).
13
14 -behaviour(xmpp_router).
15
16 -include("jlib.hrl").
17
18 %% API
19 %% xmpp_router callback
20 -export([filter/4, route/4]).
21
22 filter(From, To, Acc, Packet) ->
23 245 {From, To, Acc, Packet}.
24
25 route(From, To, Acc, Packet) ->
26 245 LDstDomain = To#jid.lserver,
27 245 case mongoose_lazy_routing:maybe_add_domain_or_subdomain(LDstDomain) of
28 true ->
29 132 mongoose_router_localdomain:route(From, To, Acc, Packet);
30 113 false -> {From, To, Acc, Packet}
31 end.
Line Hits Source