diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2011-11-02 12:24:53 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2011-11-02 12:24:53 +0000 |
commit | aab5200e1eb2deeb83ac3d313ca040d839c5cf78 (patch) | |
tree | 970ae2f2d18a5d94b96261ff8028bd6746509a12 | |
parent | 997986332a09bd0f88a38bcc5a4b3543a840d9d0 (diff) | |
download | rabbitmq-server-aab5200e1eb2deeb83ac3d313ca040d839c5cf78.tar.gz |
Refactor: I like closures as much as the next chap, but that was too many.
-rw-r--r-- | src/supervisor2.erl | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl index c797b7d1..f8d38a97 100644 --- a/src/supervisor2.erl +++ b/src/supervisor2.erl @@ -684,25 +684,16 @@ terminate_simple_children(Child, Dynamics, SupName) -> 0 -> ok end, ReportError = shutdown_error_reporter(SupName), - ReportAcc = fun (NormalErrorFun) -> - fun (_Pid, ok, Acc) -> - Acc; - (Pid, {error, normal}, Acc) -> - NormalErrorFun(Pid), - Acc; - (Pid, {error, Reason}, Acc) -> - ReportError(Reason, Child#child{pid = Pid}), - Acc - end - end, - dict:fold(case restart_permanent(Child#child.restart_type) of - true -> - ReportAcc(fun (Pid) -> - ReportError(normal, Child#child{pid = Pid}) - end); - false -> - ReportAcc(fun (_Pid) -> ok end) - end, ok, Replies), + dict:map(fun (_Pid, ok) -> + ok; + (Pid, {error, normal}) -> + case restart_permanent(Child#child.restart_type) of + true -> ReportError(normal, Child#child{pid = Pid}); + false -> ok + end; + (Pid, {error, Reason}) -> + ReportError(Reason, Child#child{pid = Pid}) + end, Replies), ok. child_exit_reason(#child{shutdown = brutal_kill}) -> kill; |