summaryrefslogtreecommitdiff
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
commitc70ac2c72afad9035bd7290208a5da6cb0595fb7 (patch)
tree97c11c4558de3c3db9db3a2c722866f04d9dca03
parente4c7f6bceec82208e65ac86366e9a67817b90f75 (diff)
downloadrabbitmq-server-c70ac2c72afad9035bd7290208a5da6cb0595fb7.tar.gz
Guard aganist the case where a delegate-executed function does some monitoring.
-rw-r--r--src/delegate.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/delegate.erl b/src/delegate.erl
index 03086a59..460a4899 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}.