@@ -130,38 +130,38 @@ The `t:tuple/0` reason are other errors like for example `{exit_status,1}`.
130
130
% %====================================================================
131
131
% % API
132
132
% %====================================================================
133
-
134
-
135
- % %%================================================================
136
- % %%
137
-
138
- % %%----------------------------------------------------------------
139
- % %% start_channel/1
140
- -doc (#{equiv => start_channel / 3 }).
133
+ -doc (#{equiv => start_channel / 2 }).
141
134
-spec start_channel (ssh :open_socket () | ssh :connection_ref () | ssh :host ()) ->
142
135
{ok , pid ()} | {ok , pid (), ssh :connection_ref ()} | {error , reason ()}.
143
136
start_channel (Dest ) ->
144
137
start_channel (Dest , []).
145
-
146
- % %%----------------------------------------------------------------
147
- % %% start_channel/2
138
+
148
139
% %% -spec:s are as if Dialyzer handled signatures for separate
149
140
% %% 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.
155
143
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.
160
145
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 ()}.
165
165
start_channel (Cm , UserOptions0 ) when is_pid (Cm ) ->
166
166
UserOptions = legacy_timeout (UserOptions0 ),
167
167
Timeout = proplists :get_value (timeout , UserOptions , infinity ),
@@ -209,14 +209,10 @@ start_channel(Dest, UserOptions0) ->
209
209
end
210
210
end .
211
211
212
- % %%----------------------------------------------------------------
213
- % %% start_channel/3
214
212
-doc """
215
- start_channel(Host, Port, Options) ->
213
+ Starts new ssh connection and channel for communicating with the SFTP server.
216
214
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
220
216
used as input to all other API functions in this module.
221
217
222
218
Options:
0 commit comments