diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-02-17 11:07:58 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-02-17 11:07:58 +0000 |
commit | f7fb7c649d129ea84ee00b0a9d7721d645014f95 (patch) | |
tree | a33ecf057cb95a7e51978362428bac3f1989a996 | |
parent | fc30e692ca99c55af52d0a0edb07a75d24e21a1b (diff) | |
download | rabbitmq-server-f7fb7c649d129ea84ee00b0a9d7721d645014f95.tar.gz |
Don't call InnerFun and remove/3 if the binding was not there.bug26014
-rw-r--r-- | src/rabbit_binding.erl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index 11e6bd38..ff950cc7 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -200,13 +200,15 @@ remove(Binding, InnerFun) -> binding_action( Binding, fun (Src, Dst, B) -> - case mnesia:read(rabbit_route, B, write) =:= [] andalso - mnesia:read(rabbit_durable_route, B, write) =/= [] of - true -> rabbit_misc:const({error, binding_not_found}); - false -> case InnerFun(Src, Dst) of - ok -> remove(Src, Dst, B); - {error, _} = Err -> rabbit_misc:const(Err) - end + case mnesia:read(rabbit_route, B, write) of + [] -> case mnesia:read(rabbit_durable_route, B, write) of + [] -> rabbit_misc:const(ok); + _ -> rabbit_misc:const({error, binding_not_found}) + end; + _ -> case InnerFun(Src, Dst) of + ok -> remove(Src, Dst, B); + {error, _} = Err -> rabbit_misc:const(Err) + end end end, fun absent_errs_only/1). |