summaryrefslogtreecommitdiff
path: root/src/delegate.erl
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-07-02 15:01:10 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-07-02 15:01:10 +0100
commit6a5c3a6c8e8ebcc8e2bbf979bfb81b2409f2442a (patch)
tree97c11c4558de3c3db9db3a2c722866f04d9dca03 /src/delegate.erl
parentc7bf242421ae71b81c0b892f711c5fe079178245 (diff)
downloadrabbitmq-server-git-6a5c3a6c8e8ebcc8e2bbf979bfb81b2409f2442a.tar.gz
Guard aganist the case where a delegate-executed function does some monitoring.
Diffstat (limited to 'src/delegate.erl')
-rw-r--r--src/delegate.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/delegate.erl b/src/delegate.erl
index 03086a590e..460a48996f 100644
--- a/src/delegate.erl
+++ b/src/delegate.erl
@@ -204,9 +204,13 @@ handle_cast({invoke, Fun, Grouped}, State = #state{node = Node}) ->
handle_info({'DOWN', Ref, process, Object, Info},
State = #state{monitors = Monitors}) ->
- WantsMonitor = dict:fetch(Ref, Monitors),
- WantsMonitor ! {'DOWN', Ref, process, Object, Info},
- {noreply, State#state{monitors = dict:erase(Ref, Monitors)}, hibernate};
+ {noreply, case dict:find(Ref, Monitors) of
+ {ok, WantsMonitor} ->
+ WantsMonitor ! {'DOWN', Ref, process, Object, Info},
+ State#state{monitors = dict:erase(Ref, Monitors)};
+ error ->
+ State
+ end, hibernate};
handle_info(_Info, State) ->
{noreply, State, hibernate}.