~ubuntu-branches/ubuntu/lucid/erlang/lucid-proposed

« back to all changes in this revision

Viewing changes to lib/ssh/src/ssh_connection_manager.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-06-11 12:18:07 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090611121807-ks7eb4xrt7dsysgx
Tags: 1:13.b.1-dfsg-1
* New upstream release.
* Removed unnecessary dependency of erlang-os-mon on erlang-observer and
  erlang-tools and added missing dependency of erlang-nox on erlang-os-mon
  (closes: #529512).
* Removed a patch to eunit application because the bug was fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
%% 
17
17
%% %CopyrightEnd%
18
18
%%
19
 
 
20
19
%%
21
 
 
22
20
%%----------------------------------------------------------------------
23
21
%% Purpose: Handles multiplexing to ssh channels and global connection
24
22
%% requests e.i. the SSH Connection Protocol (RFC 4254), that provides
255
253
    gen_server:reply(From, ok), 
256
254
 
257
255
    ConnectionMsg = decode_ssh_msg(Msg),
258
 
    case catch ssh_connection:handle_msg(ConnectionMsg, Connection0, Pid, Role) of
 
256
    try ssh_connection:handle_msg(ConnectionMsg, Connection0, Pid, Role) of
259
257
        {{replies, Replies}, Connection} ->
260
258
            lists:foreach(fun send_msg/1, Replies),
261
259
            {noreply, State#state{connection_state = Connection}};
270
268
            lists:foreach(fun send_msg/1, Replies),
271
269
            SSHOpts = proplists:get_value(ssh_opts, Opts),
272
270
            disconnect_fun(Reason, SSHOpts),
273
 
            {stop, normal, State#state{connection_state = Connection}};
274
 
        {'EXIT', _Reason} = Exit ->
275
 
            Report = io_lib:format("Connection message caused exit~n~p~n~p~n",
 
271
            {stop, normal, State#state{connection_state = Connection}}
 
272
        catch
 
273
        exit:{noproc, Reason} ->
 
274
            Report = io_lib:format("Connection probably terminated:~n~p~n~p~n",
 
275
                                   [ConnectionMsg, Reason]),
 
276
            error_logger:info_report(Report),
 
277
            {noreply, State};
 
278
        exit:Exit ->
 
279
            Report = io_lib:format("Connection message returned:~n~p~n~p~n",
276
280
                                   [ConnectionMsg, Exit]),
277
 
            error_logger:error_report(Report),
 
281
            error_logger:info_report(Report),
278
282
            {noreply, State}
279
283
    end;
280
284
 
537
541
                         opts = Opts}) ->
538
542
    SSHOpts = proplists:get_value(ssh_opts, Opts),
539
543
    disconnect_fun(Reason, SSHOpts),
540
 
    lists:foreach(fun({_, From}) -> 
541
 
                          gen_server:reply(From, {error, connection_closed})
542
 
                  end, Requests).
 
544
    (catch lists:foreach(fun({_, From}) -> 
 
545
                                 gen_server:reply(From, {error, connection_closed})
 
546
                         end, Requests)),
 
547
    ok.
543
548
 
544
549
%%--------------------------------------------------------------------
545
550
%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}