25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-13 15:16:49 +02:00

* src/ejabberd_router.erl: Added monitoring of processess that

serve domains

SVN Revision: 197
This commit is contained in:
Alexey Shchepin 2004-01-06 20:37:14 +00:00
parent 7f9b7e64c3
commit 41cc38aa6f
2 changed files with 20 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2004-01-06 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_router.erl: Added monitoring of processess that
serve domains
* src/ejabberd_app.erl: Bugfix
2004-01-03 Alexey Shchepin <alexey@sevcom.net>

View File

@ -38,6 +38,7 @@ init() ->
{attributes,
record_info(fields, route)}]),
mnesia:add_table_copy(route, node(), ram_copies),
mnesia:subscribe({table, route, simple}),
loop().
loop() ->
@ -65,6 +66,22 @@ loop() ->
end,
mnesia:transaction(F),
loop();
{mnesia_table_event, {write, #route{pid = Pid}, _ActivityId}} ->
erlang:monitor(process, Pid),
loop();
{'DOWN', _Ref, _Type, Pid, _Info} ->
F = fun() ->
Es = mnesia:select(
route,
[{#route{pid = Pid, _ = '_'},
[],
['$_']}]),
lists:foreach(fun(E) ->
mnesia:delete_object(E)
end, Es)
end,
mnesia:transaction(F),
loop();
_ ->
loop()
end.