diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-05-01 14:08:23 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-05-01 14:08:23 +0200 |
commit | d975d90fcc8e458e9553edcb17567b566c61023e (patch) | |
tree | 5086b1717b269f8177a76eb1ee16b51ef69c5dff | |
parent | f8b852c2e06905c4afca8f2a8b93daf707784b5e (diff) |
sccp_{links,user}: link to the user process
This means we get notified if the process dies, i.e. we can remove it from
our ets tables.
-rw-r--r-- | src/sccp_links.erl | 6 | ||||
-rw-r--r-- | src/sccp_user.erl | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/sccp_links.erl b/src/sccp_links.erl index 6b81b9f..fc44a7b 100644 --- a/src/sccp_links.erl +++ b/src/sccp_links.erl @@ -114,9 +114,10 @@ handle_call({register_linkset, {LocalPc, RemotePc, Name}}, false -> {reply, {error, ets_insert}, S}; _ -> - % FIXME: We need to trap the user Pid for EXIT + % We need to trap the user Pid for EXIT % in order to automatically remove any links/linksets if % the user process dies + link(FromPid), {reply, ok, S} end; @@ -137,9 +138,10 @@ handle_call({register_link, {LsName, Sls, Name}}, false -> {reply, {error, link_exists}, S}; _ -> - % FIXME: We need to trap the user Pid for EXIT + % We need to trap the user Pid for EXIT % in order to automatically remove any links if % the user process dies + link(FromPid), {reply, ok, S} end; _ -> diff --git a/src/sccp_user.erl b/src/sccp_user.erl index ccf413b..856d8d6 100644 --- a/src/sccp_user.erl +++ b/src/sccp_user.erl @@ -90,6 +90,10 @@ handle_call({bind_ssn, Ssn, Pc}, {FromPid, _FromRef}, S) -> false -> {reply, {error, ets_insert}, S}; Error -> + % We need to trap the user Pid for EXIT + % in order to automatically remove any SSN if + % the user process dies + link(FromPid), {reply, ok, S} end; |