25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01: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> 2004-01-06 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_router.erl: Added monitoring of processess that
serve domains
* src/ejabberd_app.erl: Bugfix * src/ejabberd_app.erl: Bugfix
2004-01-03 Alexey Shchepin <alexey@sevcom.net> 2004-01-03 Alexey Shchepin <alexey@sevcom.net>

View File

@ -38,6 +38,7 @@ init() ->
{attributes, {attributes,
record_info(fields, route)}]), record_info(fields, route)}]),
mnesia:add_table_copy(route, node(), ram_copies), mnesia:add_table_copy(route, node(), ram_copies),
mnesia:subscribe({table, route, simple}),
loop(). loop().
loop() -> loop() ->
@ -65,6 +66,22 @@ loop() ->
end, end,
mnesia:transaction(F), mnesia:transaction(F),
loop(); 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() loop()
end. end.