diff options
author | Hans Nilsson <hans@erlang.org> | 2019-10-30 15:20:20 +0100 |
---|---|---|
committer | Hans Nilsson <hans@erlang.org> | 2019-10-30 15:20:20 +0100 |
commit | a10b087788444a5e51a6e2e8f01af01d9292121e (patch) | |
tree | a3ae4eb7583986e31547c6dd02c559314bab9cc7 /lib/ftp | |
parent | 6bd1a7333bbaca497fb4028732b7b10cd145de94 (diff) | |
parent | b921bfee5a9e387683f0cf843a0b928737e594b9 (diff) | |
download | erlang-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.erl | 19 |
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; |