impossible case should cause an error bug23117
authorAlexandru Scvortov <alexandru@rabbitmq.com>
Tue, 26 Jul 2011 14:53:43 +0100
branchbug23117
changeset 1274668abefd149d
parent 1273 7a3d92c9ce01
child 1275 68a8204c89ba
impossible case should cause an error
src/amqp_selective_consumer.erl
     1.1 --- a/src/amqp_selective_consumer.erl	Tue Jul 26 14:25:22 2011 +0100
     1.2 +++ b/src/amqp_selective_consumer.erl	Tue Jul 26 14:53:43 2011 +0100
     1.3 @@ -114,21 +114,15 @@
     1.4  
     1.5  %% @private
     1.6  handle_consume_ok(BasicConsumeOk, _BasicConsume,
     1.7 -                  State = #state{unassigned = Unassigned,
     1.8 +                  State = #state{unassigned = Pid,
     1.9                                   consumers  = Consumers,
    1.10 -                                 monitors   = Monitors}) ->
    1.11 -    State1 = case Unassigned of
    1.12 -                 undefined ->
    1.13 -                     State;
    1.14 -                 Pid       ->
    1.15 -                     State#state{consumers  =
    1.16 -                                     dict:store(tag(BasicConsumeOk),
    1.17 -                                                Pid, Consumers),
    1.18 -                                 monitors   =
    1.19 -                                     dict:store(Pid, monitor(process, Pid),
    1.20 -                                                Monitors),
    1.21 -                                 unassigned = undefined}
    1.22 -             end,
    1.23 +                                 monitors   = Monitors})
    1.24 +  when is_pid(Pid) ->
    1.25 +    State1 = State#state{consumers  =
    1.26 +                             dict:store(tag(BasicConsumeOk), Pid, Consumers),
    1.27 +                         monitors   =
    1.28 +                             dict:store(Pid, monitor(process, Pid), Monitors),
    1.29 +                         unassigned = undefined},
    1.30      deliver(BasicConsumeOk, State1),
    1.31      {ok, State1}.
    1.32