Merged bug19847 into default

This commit is contained in:
Ben Hood 2009-07-10 11:25:44 +01:00
commit 6528c83504
1 changed files with 11 additions and 1 deletions

View File

@ -125,7 +125,6 @@ start_channel(ChannelNumber,
do3 = fun(X, Y, Z) -> Driver:do(X, Y, Z) end,
reader_pid = ReaderPid,
writer_pid = WriterPid},
process_flag(trap_exit, true),
{ok, ChannelPid} = gen_server:start_link(amqp_channel,
[ChannelState], []),
NewState = register_channel(Number, ChannelPid, State),
@ -191,6 +190,7 @@ close_connection(Close, From, State = #connection_state{driver = Driver}) ->
%%---------------------------------------------------------------------------
init([InitialState, Driver]) when is_atom(Driver) ->
process_flag(trap_exit, true),
State = Driver:handshake(InitialState),
{ok, State#connection_state{driver = Driver} }.
@ -240,6 +240,16 @@ handle_info( {'EXIT', Pid, normal}, State) ->
handle_info( {'EXIT', _Pid, {socket_error, Reason}}, State) ->
{stop, {socket_error, Reason}, State};
handle_info( {'EXIT', _Pid, Reason = {unknown_message_type, _}}, State) ->
{stop, Reason, State};
handle_info( {'EXIT', _Pid, Reason = connection_socket_closed_unexpectedly},
State) ->
{stop, Reason, State};
handle_info( {'EXIT', _Pid, Reason = connection_timeout}, State) ->
{stop, Reason, State};
handle_info( {'EXIT', Pid, Reason}, State) ->
io:format("Connection: Handling exit from ~p --> ~p~n", [Pid, Reason]),
{noreply, unregister_channel(Pid, State) }.