diff options
author | Anders Svensson <[email protected]> | 2018-03-05 11:33:46 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2018-03-05 11:33:46 +0100 |
commit | 9ed04ac83dc3bf68bc968e18a3dbd0fd73ea3ce6 (patch) | |
tree | 96cac68b3a84a8bba8388fabebd6628d3b53710b | |
parent | 57d9dbb0233ed1da15f520cdb3c5d047a346429c (diff) | |
parent | cbbc2588a1f9acea502b0fde0fcac507b02ba1ea (diff) | |
download | otp-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
-rw-r--r-- | lib/diameter/src/base/diameter_reg.erl | 17 |
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 |