Skip to content

Commit 2fcaee9

Browse files
committed
ssh: fix ssh_sftp:start_channel docs
1 parent a66a465 commit 2fcaee9

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

Diff for: lib/ssh/src/ssh_sftp.erl

+26-30
Original file line numberDiff line numberDiff line change
@@ -130,38 +130,38 @@ The `t:tuple/0` reason are other errors like for example `{exit_status,1}`.
130130
%%====================================================================
131131
%% API
132132
%%====================================================================
133-
134-
135-
%%%================================================================
136-
%%%
137-
138-
%%%----------------------------------------------------------------
139-
%%% start_channel/1
140-
-doc(#{equiv => start_channel/3}).
133+
-doc(#{equiv => start_channel/2}).
141134
-spec start_channel(ssh:open_socket() | ssh:connection_ref() | ssh:host()) ->
142135
{ok, pid()} | {ok, pid(), ssh:connection_ref()} | {error, reason()}.
143136
start_channel(Dest) ->
144137
start_channel(Dest, []).
145-
146-
%%%----------------------------------------------------------------
147-
%%% start_channel/2
138+
148139
%%% -spec:s are as if Dialyzer handled signatures for separate
149140
%%% function clauses.
150-
-doc(#{equiv => start_channel/3}).
151-
-spec start_channel(ssh:open_socket(),
152-
[ssh:client_option() | sftp_option()]
153-
)
154-
-> {ok,pid(),ssh:connection_ref()} | {error,reason()};
141+
-doc """
142+
Starts new ssh channel for communicating with the SFTP server.
155143
156-
(ssh:connection_ref(),
157-
[sftp_option()]
158-
)
159-
-> {ok,pid()} | {ok,pid(),ssh:connection_ref()} | {error,reason()};
144+
Starts an ssh channel when first argument is a connection reference.
160145
161-
(ssh:host(),
162-
[ssh:client_option() | sftp_option()]
163-
)
164-
-> {ok,pid(),ssh:connection_ref()} | {error,reason()} .
146+
Equivalent to [start_channel(Host, 22, UserOptions)](`start_channel/3`) when
147+
first argument is recognized as network host.
148+
149+
Otherwise, first argument is treated as a network socket which will be used for
150+
establishing new SSH connection. New connection reference will be used for
151+
starting an SSH channel.
152+
153+
The returned `pid` for this process is to be used as input to all other API
154+
functions in this module.
155+
156+
See also (`start_channel/3`).
157+
158+
""".
159+
-spec start_channel(ssh:open_socket(), [ssh:client_option() | sftp_option()]) ->
160+
{ok,pid(),ssh:connection_ref()} | {error,reason()};
161+
(ssh:connection_ref(), [sftp_option()]) ->
162+
{ok,pid()} | {ok,pid(),ssh:connection_ref()} | {error,reason()};
163+
(ssh:host(), [ssh:client_option() | sftp_option()]) ->
164+
{ok,pid(),ssh:connection_ref()} | {error,reason()}.
165165
start_channel(Cm, UserOptions0) when is_pid(Cm) ->
166166
UserOptions = legacy_timeout(UserOptions0),
167167
Timeout = proplists:get_value(timeout, UserOptions, infinity),
@@ -209,14 +209,10 @@ start_channel(Dest, UserOptions0) ->
209209
end
210210
end.
211211

212-
%%%----------------------------------------------------------------
213-
%%% start_channel/3
214212
-doc """
215-
start_channel(Host, Port, Options) ->
213+
Starts new ssh connection and channel for communicating with the SFTP server.
216214
217-
If no connection reference is provided, a connection is set up, and the new
218-
connection is returned. An SSH channel process is started to handle the
219-
communication with the SFTP server. The returned `pid` for this process is to be
215+
The returned `pid` for this process is to be
220216
used as input to all other API functions in this module.
221217
222218
Options:

0 commit comments

Comments
 (0)