From 75ca7672b5c7bb07196a3a2b294157479ff4f00a Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Mon, 15 Dec 2014 09:54:26 +0100 Subject: ssh: Improve errorhandling in ssh_connection.erl If a channel is closed by the peer while using a function with call semantics in ssh_connection.erl return {error, closed}. Document that the functions can return {error, timeout | closed} and not only ssh_request_status() --- lib/ssh/doc/src/ssh_connection.xml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/ssh/doc') diff --git a/lib/ssh/doc/src/ssh_connection.xml b/lib/ssh/doc/src/ssh_connection.xml index ff72cf7ee0..5e2926dfa6 100644 --- a/lib/ssh/doc/src/ssh_connection.xml +++ b/lib/ssh/doc/src/ssh_connection.xml @@ -62,6 +62,7 @@

ssh_request_status() = success | failure

event() = {ssh_cm, ssh_connection_ref(), ssh_event_msg()}

ssh_event_msg() = data_events() | status_events() | terminal_events()

+

reason() = timeout | closed

data_events() @@ -218,7 +219,7 @@ - exec(ConnectionRef, ChannelId, Command, TimeOut) -> ssh_request_status() + exec(ConnectionRef, ChannelId, Command, TimeOut) -> ssh_request_status() | {error, reason()} Request that the server start the execution of the given command. ConnectionRef = ssh_connection_ref() @@ -274,7 +275,8 @@ - ptty_alloc(ConnectionRef, ChannelId, Options, Timeout) -> success | failure + ptty_alloc(ConnectionRef, ChannelId, Options) -> + ptty_alloc(ConnectionRef, ChannelId, Options, Timeout) -> > ssh_request_status() | {error, reason()} Send status replies to requests that want such replies. ConnectionRef = ssh_connection_ref() @@ -374,7 +376,7 @@ session_channel(ConnectionRef, Timeout) -> session_channel(ConnectionRef, InitialWindowSize, - MaxPacketSize, Timeout) -> {ok, ssh_channel_id()} | {error, Reason} + MaxPacketSize, Timeout) -> {ok, ssh_channel_id()} | {error, reason()} Opens a channel for a ssh session. ConnectionRef = ssh_connection_ref() @@ -391,7 +393,7 @@ - setenv(ConnectionRef, ChannelId, Var, Value, TimeOut) -> ssh_request_status() + setenv(ConnectionRef, ChannelId, Var, Value, TimeOut) -> ssh_request_status() | {error, reason()} Environment variables may be passed to the shell/command to be started later. @@ -409,7 +411,7 @@ - shell(ConnectionRef, ChannelId) -> ssh_request_status() + shell(ConnectionRef, ChannelId) -> ssh_request_status() | {error, closed} Requests that the user's default shell (typically defined in /etc/passwd in UNIX systems) shall be executed at the server @@ -426,7 +428,7 @@ - subsystem(ConnectionRef, ChannelId, Subsystem, Timeout) -> ssh_request_status() + subsystem(ConnectionRef, ChannelId, Subsystem, Timeout) -> ssh_request_status() | {error, reason()} ConnectionRef = ssh_connection_ref() -- cgit v1.2.3