Skip to content

Commit

Permalink
Adding fallback for handle_info. Not sure that I didn't miss something.
Browse files Browse the repository at this point in the history
  • Loading branch information
si14 committed Oct 25, 2011
1 parent 821d6e7 commit e04a540
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/gen_qserver.erl
Expand Up @@ -172,6 +172,18 @@ handle_info({#'basic.deliver'{routing_key=Key}, Content}, State) ->
{noreply, NewState};
_ ->
handle_cast({Key,Payload}, State)
end;

%% Fallback
handle_info(Info, #gen_qstate{module=Module,
module_state=ModuleState}=State) ->
case Module:handle_info(Info, ModuleState) of
{noreply, NewModuleState} ->
{noreply, State#gen_qstate{module_state=NewModuleState}};
{noreply, NewModuleState, AfterRequest} -> % timeout/hibernate
{noreply, State#gen_qstate{module_state=NewModuleState}, AfterRequest};
{stop, Reason, NewModuleState} ->
{stop, Reason, State#gen_qstate{module_state=NewModuleState}}
end.


Expand Down

0 comments on commit e04a540

Please sign in to comment.