sccp_{links,user}: Add EXIT info handler for ets table cleanup
Once a linked process dies, we evict all related records from our ETS tables.
This commit is contained in:
parent
d975d90fcc
commit
49fb161451
|
@ -170,6 +170,13 @@ handle_cast(Info, S) ->
|
|||
{info, Info}, {state, S}]),
|
||||
{noreply, S}.
|
||||
|
||||
handle_info({'EXIT', Pid, Reason}, S) ->
|
||||
io:format("EXIT from Process ~p (~p), cleaning up tables~n",
|
||||
[Pid, Reason]),
|
||||
#su_state{linkset_tbl = LinksetTbl, link_tbl = LinkTbl} = S,
|
||||
ets:match_delete(LinksetTbl, #slinkset{user_pid = Pid}),
|
||||
ets:match_delete(LinkTbl, #slink{user_pid = Pid}),
|
||||
{noreply, S};
|
||||
handle_info(Info, S) ->
|
||||
error_logger:error_report(["unknown handle_info",
|
||||
{module, ?MODULE},
|
||||
|
|
|
@ -110,6 +110,12 @@ handle_cast(Info, S) ->
|
|||
{info, Info}, {state, S}]),
|
||||
{noreply, S}.
|
||||
|
||||
handle_info({'EXIT', Pid, Reason}, S) ->
|
||||
#scu_state{user_table = Tbl} = S,
|
||||
io:format("EXIT from Process ~p (~p), cleaning up tables~n",
|
||||
[Pid, Reason]),
|
||||
ets:match_delete(Tbl, #scu_record{user_pid = Pid}),
|
||||
{noreply, S};
|
||||
handle_info(Info, S) ->
|
||||
error_logger:error_report(["unknown handle_info",
|
||||
{module, ?MODULE},
|
||||
|
|
Loading…
Reference in New Issue