aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2013-11-13 14:24:00 +0100
committerIngela Anderton Andin <[email protected]>2014-02-05 10:32:26 +0100
commit1eddd2d967aa99c32ebd2d1b573113f5bc988bc1 (patch)
tree19a9ea87196e4c7587bfbc285b6974102ecae1bf /lib/inets
parentf73583ae73ec7b61bc1126f16390eb70d38257a6 (diff)
downloadotp-1eddd2d967aa99c32ebd2d1b573113f5bc988bc1.tar.gz
otp-1eddd2d967aa99c32ebd2d1b573113f5bc988bc1.tar.bz2
otp-1eddd2d967aa99c32ebd2d1b573113f5bc988bc1.zip
ftp: Add timeouts to ssl:connect
Diffstat (limited to 'lib/inets')
-rw-r--r--lib/inets/src/ftp/ftp.erl20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/inets/src/ftp/ftp.erl b/lib/inets/src/ftp/ftp.erl
index 15c0290ae1..d53cca231f 100644
--- a/lib/inets/src/ftp/ftp.erl
+++ b/lib/inets/src/ftp/ftp.erl
@@ -101,8 +101,8 @@
-type common_reason() :: 'econn' | 'eclosed' | term().
-type file_write_error_reason() :: term(). % See file:write for more info
-%%-define(DBG(F,A), 'n/a').
--define(DBG(F,A), io:format(F,A)).
+-define(DBG(F,A), 'n/a').
+%%-define(DBG(F,A), io:format(F,A)).
%%%=========================================================================
%%% API - CLIENT FUNCTIONS
@@ -1595,10 +1595,11 @@ handle_user_account(Acc, State) ->
%%--------------------------------------------------------------------------
handle_ctrl_result({tls_upgrade, _}, #state{csock = {tcp, Socket},
tls_options = TLSOptions,
+ timeout = Timeout,
caller = open, client = From}
= State0) ->
?DBG('<--ctrl ssl:connect(~p, ~p)~n~p~n',[Socket,TLSOptions,State0]),
- case ssl:connect(Socket, TLSOptions) of
+ case ssl:connect(Socket, TLSOptions, Timeout) of
{ok, TLSSocket} ->
State = State0#state{csock = {ssl,TLSSocket}},
send_ctrl_message(State, mk_cmd("PBSZ 0", [])),
@@ -2132,7 +2133,7 @@ accept_data_connection(#state{mode = active,
{ok, Socket} when is_list(TLSOptions) ->
gen_tcp:close(LSock),
?DBG('<--data ssl:connect(~p, ~p)~n~p~n',[Socket,TLSOptions,State0]),
- case ssl:connect(Socket, TLSOptions) of
+ case ssl:connect(Socket, TLSOptions, DTimeout) of
{ok, TLSSocket} ->
{ok, State0#state{dsock={ssl,TLSSocket}}};
{error, Reason} ->
@@ -2146,10 +2147,11 @@ accept_data_connection(#state{mode = active,
end;
accept_data_connection(#state{mode = passive,
+ dtimeout = DTimeout,
dsock = {tcp,Socket},
tls_options = TLSOptions} = State) when is_list(TLSOptions) ->
?DBG('<--data ssl:connect(~p, ~p)~n~p~n',[Socket,TLSOptions,State]),
- case ssl:connect(Socket, TLSOptions) of
+ case ssl:connect(Socket, TLSOptions, DTimeout) of
{ok, TLSSocket} ->
{ok, State#state{dsock={ssl,TLSSocket}}};
{error, Reason} ->
@@ -2159,13 +2161,13 @@ accept_data_connection(#state{mode = passive} = State) ->
{ok,State}.
-send_ctrl_message(S=#state{csock = Socket, verbose = Verbose}, Message) ->
+send_ctrl_message(_S=#state{csock = Socket, verbose = Verbose}, Message) ->
verbose(lists:flatten(Message),Verbose,send),
- ?DBG('<--ctrl ~p ---- ~s~p~n',[Socket,Message,S]),
+ ?DBG('<--ctrl ~p ---- ~s~p~n',[Socket,Message,_S]),
send_message(Socket, Message).
-send_data_message(S=#state{dsock = Socket}, Message) ->
- ?DBG('<==data ~p ==== ~s~p~n',[Socket,Message,S]),
+send_data_message(_S=#state{dsock = Socket}, Message) ->
+ ?DBG('<==data ~p ==== ~s~p~n',[Socket,Message,_S]),
case send_message(Socket, Message) of
ok ->
ok;