diff options
author | Dan Gudmundsson <[email protected]> | 2010-08-31 12:08:04 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2010-08-31 12:08:04 +0200 |
commit | 007fdaba74e35a01ab4c469d690c89620e1d1f45 (patch) | |
tree | 23d30dbcfe6483daf0586145b5a3363b9625440d /lib/ssl/src | |
parent | d6d9b62971fd2ff09e4d7d49e0bf59f2e4e92acd (diff) | |
parent | 0f3963c4453cb3363612f948c2395492a2a28458 (diff) | |
download | otp-007fdaba74e35a01ab4c469d690c89620e1d1f45.tar.gz otp-007fdaba74e35a01ab4c469d690c89620e1d1f45.tar.bz2 otp-007fdaba74e35a01ab4c469d690c89620e1d1f45.zip |
Merge branch 'dgud/ssl/empty_msg_problem/OTP-8790' into dev
* dgud/ssl/empty_msg_problem/OTP-8790:
Fix receiving empty packets.
Diffstat (limited to 'lib/ssl/src')
-rw-r--r-- | lib/ssl/src/ssl_connection.erl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index 76422155a5..bb2d874718 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -1638,8 +1638,6 @@ application_data(Data, #state{user_application = {_Mon, Pid}, true -> <<Buffer0/binary, Data/binary>> end, case get_data(SOpts, BytesToRead, Buffer1) of - {ok, <<>>, Buffer} -> % no reply, we need more data - next_record(State0#state{user_data_buffer = Buffer}); {ok, ClientData, Buffer} -> % Send data SocketOpt = deliver_app_data(SOpts, ClientData, Pid, From), State = State0#state{user_data_buffer = Buffer, @@ -1655,12 +1653,16 @@ application_data(Data, #state{user_application = {_Mon, Pid}, true -> %% We have more data application_data(<<>>, State) end; + {more, Buffer} -> % no reply, we need more data + next_record(State0#state{user_data_buffer = Buffer}); {error,_Reason} -> %% Invalid packet in packet mode deliver_packet_error(SOpts, Buffer1, Pid, From), {stop, normal, State0} end. %% Picks ClientData +get_data(_, _, <<>>) -> + {more, <<>>}; get_data(#socket_options{active=Active, packet=Raw}, BytesToRead, Buffer) when Raw =:= raw; Raw =:= 0 -> %% Raw Mode if @@ -1673,13 +1675,13 @@ get_data(#socket_options{active=Active, packet=Raw}, BytesToRead, Buffer) {ok, Data, Rest}; true -> %% Passive Mode not enough data - {ok, <<>>, Buffer} + {more, Buffer} end; get_data(#socket_options{packet=Type, packet_size=Size}, _, Buffer) -> PacketOpts = [{packet_size, Size}], case decode_packet(Type, Buffer, PacketOpts) of {more, _} -> - {ok, <<>>, Buffer}; + {more, Buffer}; Decoded -> Decoded end. @@ -1831,7 +1833,7 @@ next_state(StateName, #ssl_tls{type = ?APPLICATION_DATA, fragment = Data}, State case application_data(Data, State0) of Stop = {stop,_,_} -> Stop; - {Record, State} -> + {Record, State} -> next_state(StateName, Record, State) end; next_state(StateName, #ssl_tls{type = ?CHANGE_CIPHER_SPEC, fragment = <<1>>} = |