diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-07-26 15:54:45 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-07-26 15:54:45 +0100 |
commit | 9d7b2f212b0ce1daa03f9595e85134c72f839cbc (patch) | |
tree | 14f66e07100a8d302caf9015ca422532747a7d88 | |
parent | 6d2b3bc9337564bff81c8e33f60faf1efdd413b2 (diff) | |
download | rabbitmq-server-9d7b2f212b0ce1daa03f9595e85134c72f839cbc.tar.gz |
combine function heads
-rw-r--r-- | src/rabbit_limiter.erl | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl index beffe341..476f0d79 100644 --- a/src/rabbit_limiter.erl +++ b/src/rabbit_limiter.erl @@ -202,19 +202,15 @@ maybe_notify(OldState, NewState) -> false -> {cont, NewState} end. -maybe_call(undefined, _Call, Default) -> - Default; -maybe_call(#token{enabled = false}, _Call, Default) -> - Default; -maybe_call(#token{pid = Pid}, Call, _Default) -> - gen_server2:call(Pid, Call, infinity). +maybe_call(#token{pid = Pid, enabled = true}, Call, _Default) -> + gen_server2:call(Pid, Call, infinity); +maybe_call(_, _Call, Default) -> + Default. +maybe_cast(#token{pid = Pid, enabled = true}, Cast) -> + gen_server2:cast(Pid, Cast); maybe_cast(undefined, _Call) -> - ok; -maybe_cast(#token{enabled = false}, _Cast) -> - ok; -maybe_cast(#token{pid = Pid}, Cast) -> - gen_server2:cast(Pid, Cast). + ok. limit_reached(#lim{prefetch_count = Limit, volume = Volume}) -> Limit =/= 0 andalso Volume >= Limit. |