diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftp/src/ftp.erl | 24 | ||||
-rw-r--r-- | lib/ftp/src/ftp_internal.hrl | 28 |
2 files changed, 3 insertions, 49 deletions
diff --git a/lib/ftp/src/ftp.erl b/lib/ftp/src/ftp.erl index 083ca9fc87..e633c9343d 100644 --- a/lib/ftp/src/ftp.erl +++ b/lib/ftp/src/ftp.erl @@ -225,22 +225,17 @@ open(Host, Port) when is_integer(Port) -> %% </BACKWARD-COMPATIBILLITY> open(Host, Opts) when is_list(Opts) -> - ?fcrt("open", [{host, Host}, {opts, Opts}]), try {ok, StartOptions} = start_options(Opts), - ?fcrt("open", [{start_options, StartOptions}]), {ok, OpenOptions} = open_options([{host, Host}|Opts]), - ?fcrt("open", [{open_options, OpenOptions}]), case start_link(StartOptions, []) of {ok, Pid} -> do_open(Pid, OpenOptions, tls_options(Opts)); Error1 -> - ?fcrt("open - error", [{error1, Error1}]), Error1 end catch throw:Error2 -> - ?fcrt("open - error", [{error2, Error2}]), Error2 end. @@ -1033,7 +1028,6 @@ handle_call({Pid, _}, _, #state{owner = Owner} = State) when Owner =/= Pid -> {reply, {error, not_connection_owner}, State}; handle_call({_, {open, ip_comm, Opts}}, From, State) -> - ?fcrd("handle_call(open)", [{opts, Opts}]), case key_search(host, Opts, undefined) of undefined -> {stop, normal, {error, ehost}, State}; @@ -1053,16 +1047,10 @@ handle_call({_, {open, ip_comm, Opts}}, From, State) -> dtimeout = DTimeout, ftp_extension = FtpExt}, - ?fcrd("handle_call(open) -> setup ctrl connection with", - [{host, Host}, {port, Port}, {timeout, Timeout}]), case setup_ctrl_connection(Host, Port, Timeout, State2) of {ok, State3, WaitTimeout} -> - ?fcrd("handle_call(open) -> ctrl connection setup done", - [{waittimeout, WaitTimeout}]), {noreply, State3, WaitTimeout}; - {error, Reason} -> - ?fcrd("handle_call(open) -> ctrl connection setup failed", - [{reason, Reason}]), + {error, _Reason} -> gen_server:reply(From, {error, ehost}), {stop, normal, State2#state{client = undefined}} end @@ -2454,7 +2442,6 @@ start_chunk(#state{client = From} = State) -> %% priority %% flags (for backward compatibillity) start_options(Options) -> - ?fcrt("start_options", [{options, Options}]), case lists:keysearch(flags, 1, Options) of {value, {flags, Flags}} -> Verbose = lists:member(verbose, Flags), @@ -2509,7 +2496,6 @@ start_options(Options) -> %% ftp_extension open_options(Options) -> - ?fcrt("open_options", [{options, Options}]), ValidateMode = fun(active) -> true; (passive) -> true; @@ -2573,11 +2559,8 @@ tls_options(Options) -> proplists:get_value(tls, Options, undefined). validate_options([], [], Acc) -> - ?fcrt("validate_options -> done", [{acc, Acc}]), {ok, lists:reverse(Acc)}; validate_options([], ValidOptions, Acc) -> - ?fcrt("validate_options -> done", - [{valid_options, ValidOptions}, {acc, Acc}]), %% Check if any mandatory options are missing! case [{Key, Reason} || {Key, _, true, Reason} <- ValidOptions] of [] -> @@ -2588,19 +2571,14 @@ validate_options([], ValidOptions, Acc) -> throw({error, Reason}) end; validate_options([{Key, Value}|Options], ValidOptions, Acc) -> - ?fcrt("validate_options -> check", - [{key, Key}, {value, Value}, {acc, Acc}]), case lists:keysearch(Key, 1, ValidOptions) of {value, {Key, Validate, _, Default}} -> case (catch Validate(Value)) of true -> - ?fcrt("validate_options -> check - accept", []), NewValidOptions = lists:keydelete(Key, 1, ValidOptions), validate_options(Options, NewValidOptions, [{Key, Value} | Acc]); _ -> - ?fcrt("validate_options -> check - reject", - [{default, Default}]), NewValidOptions = lists:keydelete(Key, 1, ValidOptions), validate_options(Options, NewValidOptions, [{Key, Default} | Acc]) diff --git a/lib/ftp/src/ftp_internal.hrl b/lib/ftp/src/ftp_internal.hrl index 3c6c4d5e0b..84f980e8fd 100644 --- a/lib/ftp/src/ftp_internal.hrl +++ b/lib/ftp/src/ftp_internal.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2016. All Rights Reserved. +%% Copyright Ericsson AB 2005-2018. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -22,23 +22,6 @@ -ifndef(ftp_internal_hrl). -define(ftp_internal_hrl, true). -%%-include_lib("inets/src/inets_app/inets_internal.hrl"). - -%% Various trace macros - --define(report(Severity, Label, Service, Content), - inets_trace:report_event(Severity, Label, Service, - [{module, ?MODULE}, {line, ?LINE} | Content])). --define(report_important(Label, Service, Content), - ?report(20, Label, Service, Content)). --define(report_verbose(Label, Service, Content), - ?report(40, Label, Service, Content)). --define(report_debug(Label, Service, Content), - ?report(60, Label, Service, Content)). --define(report_trace(Label, Service, Content), - ?report(80, Label, Service, Content)). - - -define(CR, $\r). -define(LF, $\n). -define(CRLF, [$\r,$\n]). @@ -47,13 +30,6 @@ -define(LEFT_PAREN, $(). -define(RIGHT_PAREN, $)). -define(WHITE_SPACE, $ ). --define(DOUBLE_QUOTE, $"). - - --define(SERVICE, ftpc). --define(fcri(Label, Content), ?report_important(Label, ?SERVICE, Content)). --define(fcrv(Label, Content), ?report_verbose(Label, ?SERVICE, Content)). --define(fcrd(Label, Content), ?report_debug(Label, ?SERVICE, Content)). --define(fcrt(Label, Content), ?report_trace(Label, ?SERVICE, Content)). +-define(DOUBLE_QUOTE, $"). -endif. % -ifdef(ftp_internal_hrl). |