Skip to content

Commit

Permalink
Show abort message
Browse files Browse the repository at this point in the history
  • Loading branch information
jbucar committed Sep 5, 2017
1 parent d176318 commit 7062330
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/awre_con.erl
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,14 @@ handle_cast(_Request, State) ->


handle_info(Data,#state{transport = {T,TState}} = State) ->
{ok,NewTState} = T:handle_info(Data,TState),
{noreply,State#state{transport={T,NewTState}}};
Res = T:handle_info(Data,TState),
case Res of
{ok,NewTState} ->
{noreply,State#state{transport={T,NewTState}}};
{stop,Reason,NewTState} ->
io:format( "rako: stop ~p~n", [Reason]),
{stop,Reason,State#state{transport={T,NewTState}}}
end;
handle_info(_Info, State) ->
{noreply, State}.

Expand Down Expand Up @@ -198,9 +204,10 @@ handle_message_from_router({welcome,SessionId,RouterDetails},State) ->
{ok,State};

handle_message_from_router({abort,Details,Reason},State) ->
io:format( "Abort: Details=~p, Reason=~p~n", [Details, Reason] ),
{From,_} = get_ref(hello,hello,State),
gen_server:reply(From,{abort,Details,Reason}),
{stop,normal,State};
{ok,State};

handle_message_from_router({goodbye,_Details,_Reason},#state{goodbye_sent=GS}=State) ->
NewState = case GS of
Expand Down

0 comments on commit 7062330

Please sign in to comment.