diff options
author | Anders Svensson <[email protected]> | 2017-09-07 22:20:49 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2017-09-07 22:20:49 +0200 |
commit | 97d9651c856960cf1ff62bded434efcc384a1f77 (patch) | |
tree | e1e274f68e77beefcf43127ce87f231965fb56c9 /lib/diameter/src/base | |
parent | fae8ca0c37e54ad109b1612185d17dc5695bebcc (diff) | |
download | otp-97d9651c856960cf1ff62bded434efcc384a1f77.tar.gz otp-97d9651c856960cf1ff62bded434efcc384a1f77.tar.bz2 otp-97d9651c856960cf1ff62bded434efcc384a1f77.zip |
Simplify implementation in diameter_reg (take 2)
Simplify the simplification. The order of sending is changed, but the
order isn't significant.
Diffstat (limited to 'lib/diameter/src/base')
-rw-r--r-- | lib/diameter/src/base/diameter_reg.erl | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/diameter/src/base/diameter_reg.erl b/lib/diameter/src/base/diameter_reg.erl index 9ada36acc5..bd5db54a5c 100644 --- a/lib/diameter/src/base/diameter_reg.erl +++ b/lib/diameter/src/base/diameter_reg.erl @@ -340,24 +340,22 @@ notify(Op, {_,_} = Rec, #state{notify = Dict} = S) -> notify(Op, {_, Pid} = Rec, Pat, Rcvrs, Dict) -> case lists:member(Rec, match(Pat, Pid)) of true -> - reset(Pat, Dict, lists:foldr(fun(P,A) -> send(P, Op, Rec, A) end, - [], - Rcvrs)); + reset(Pat, Dict, [P || P <- Rcvrs, send(P, Op, Rec)]); false -> Dict end. -%% send/4 +%% send/3 -send([Pid | T] = Rcvr, Op, Rec, Acc) -> +send([Pid | T], Op, Rec) -> Pid ! {T, Op, Rec}, - [Rcvr | Acc]; + true; %% No processes wait on remove: they receive notification immediately %% or at add, by construction. -send({_,_} = From, add, Rec, Acc) -> +send({_,_} = From, add, Rec) -> gen_server:reply(From, [Rec]), - Acc. + false. %% down/2 |