summaryrefslogtreecommitdiff
path: root/lib/ftp
diff options
context:
space:
mode:
authorHans Nilsson <hans@erlang.org>2019-10-30 15:20:20 +0100
committerHans Nilsson <hans@erlang.org>2019-10-30 15:20:20 +0100
commita10b087788444a5e51a6e2e8f01af01d9292121e (patch)
treea3ae4eb7583986e31547c6dd02c559314bab9cc7 /lib/ftp
parent6bd1a7333bbaca497fb4028732b7b10cd145de94 (diff)
parentb921bfee5a9e387683f0cf843a0b928737e594b9 (diff)
downloaderlang-a10b087788444a5e51a6e2e8f01af01d9292121e.tar.gz
Merge branch 'maint'
* maint: ftp: improve fix to infinite loop ftp: Fix infinite ctrl_data loop
Diffstat (limited to 'lib/ftp')
-rw-r--r--lib/ftp/src/ftp.erl19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/ftp/src/ftp.erl b/lib/ftp/src/ftp.erl
index e9be7b8ff7..2f7a67df67 100644
--- a/lib/ftp/src/ftp.erl
+++ b/lib/ftp/src/ftp.erl
@@ -1375,11 +1375,11 @@ handle_info({Transport, Socket, Data}, #state{csock = {Transport, Socket},
verbose = Verbose,
caller = Caller,
client = From,
- ctrl_data = {CtrlData, AccLines,
+ ctrl_data = {BinCtrlData, AccLines,
LineStatus}}
= State0) ->
- ?DBG('--ctrl ~p ----> ~s~p~n',[Socket,<<CtrlData/binary, Data/binary>>,State]),
- case ftp_response:parse_lines(<<CtrlData/binary, Data/binary>>,
+ ?DBG('--ctrl ~p ----> ~s~p~n',[Socket,<<BinCtrlData/binary, Data/binary>>,State]),
+ case ftp_response:parse_lines(<<BinCtrlData/binary, Data/binary>>,
AccLines, LineStatus) of
{ok, Lines, NextMsgData} ->
verbose(Lines, Verbose, 'receive'),
@@ -1399,12 +1399,13 @@ handle_info({Transport, Socket, Data}, #state{csock = {Transport, Socket},
ctrl_data =
{NextMsgData, [], start}})
end;
- {continue, NewCtrlData} when NewCtrlData =/= CtrlData ->
- ?DBG(' ...Continue... ctrl_data=~p~n',[NewCtrlData]),
- State = activate_ctrl_connection(State0),
- {noreply, State#state{ctrl_data = NewCtrlData}};
- {continue, NewCtrlData} when NewCtrlData == CtrlData ->
- ?DBG(' ...Continue... ctrl_data=~p~n',[NewCtrlData]),
+ {continue, CtrlData} when CtrlData =/= State0#state.ctrl_data ->
+ ?DBG(' ...Continue... ctrl_data=~p~n',[CtrlData]),
+ State1 = State0#state{ctrl_data = CtrlData},
+ State = activate_ctrl_connection(State1),
+ {noreply, State};
+ {continue, CtrlData} ->
+ ?DBG(' ...Continue... ctrl_data=~p~n',[CtrlData]),
{noreply, State0}
end;