aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2018-03-05 11:33:46 +0100
committerAnders Svensson <[email protected]>2018-03-05 11:33:46 +0100
commit9ed04ac83dc3bf68bc968e18a3dbd0fd73ea3ce6 (patch)
tree96cac68b3a84a8bba8388fabebd6628d3b53710b /lib/diameter/src
parent57d9dbb0233ed1da15f520cdb3c5d047a346429c (diff)
parentcbbc2588a1f9acea502b0fde0fcac507b02ba1ea (diff)
downloadotp-9ed04ac83dc3bf68bc968e18a3dbd0fd73ea3ce6.tar.gz
otp-9ed04ac83dc3bf68bc968e18a3dbd0fd73ea3ce6.tar.bz2
otp-9ed04ac83dc3bf68bc968e18a3dbd0fd73ea3ce6.zip
Merge branch 'anders/diameter/reg/OTP-14839' into maint
* anders/diameter/reg/OTP-14839: Fix diameter_reg:subscribe/2 remove notification
Diffstat (limited to 'lib/diameter/src')
-rw-r--r--lib/diameter/src/base/diameter_reg.erl17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/diameter/src/base/diameter_reg.erl b/lib/diameter/src/base/diameter_reg.erl
index 5b7cfab31a..c1762a07e3 100644
--- a/lib/diameter/src/base/diameter_reg.erl
+++ b/lib/diameter/src/base/diameter_reg.erl
@@ -246,8 +246,11 @@ handle_call({add, Uniq, Key}, {Pid, _}, S) ->
handle_call({remove, Key}, {Pid, _}, S) ->
Rec = {Key, Pid},
- ets:delete_object(?TABLE, Rec),
- {reply, true, notify(remove, Rec, S)};
+ {reply, true, try
+ notify(remove, Rec, S)
+ after
+ ets:delete_object(?TABLE, Rec)
+ end};
handle_call({wait, Pat}, {Pid, _} = From, S) ->
NS = add_monitor(Pid, S),
@@ -370,10 +373,12 @@ send({_,_} = From, add, Rec) ->
down(Pid, #state{monitors = Ps} = S) ->
Recs = match('_', Pid),
- ets:match_delete(?TABLE, {'_', Pid}),
- lists:foldl(fun(R,NS) -> notify(remove, R, NS) end,
- flush(Pid, S#state{monitors = sets:del_element(Pid, Ps)}),
- Recs).
+ Acc0 = flush(Pid, S#state{monitors = sets:del_element(Pid, Ps)}),
+ try
+ lists:foldl(fun(R,NS) -> notify(remove, R, NS) end, Acc0, Recs)
+ after
+ ets:match_delete(?TABLE, {'_', Pid})
+ end.
%% flush/3