aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2019-03-16 22:59:41 +0100
committerIngela Anderton Andin <[email protected]>2019-03-16 22:59:41 +0100
commit18e8014fe2afa454ed644a731f7ddf820b79bb16 (patch)
tree7576c8251c1360e49001569bd2a5f9ff97a65c1c
parent620ac3e68c5bc8b36143965fcf2892a07dc005c4 (diff)
downloadotp-18e8014fe2afa454ed644a731f7ddf820b79bb16.tar.gz
otp-18e8014fe2afa454ed644a731f7ddf820b79bb16.tar.bz2
otp-18e8014fe2afa454ed644a731f7ddf820b79bb16.zip
ssl: Cancel recv timer in all places
Would cause connection to crash although all data was delivered to ssl:recv
-rw-r--r--lib/ssl/src/tls_connection.erl17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl
index 3229004c9d..2b9f9f1e93 100644
--- a/lib/ssl/src/tls_connection.erl
+++ b/lib/ssl/src/tls_connection.erl
@@ -223,7 +223,22 @@ next_event(StateName, Record, State, Actions) ->
%%% TLS record protocol level application data messages
-
+handle_protocol_record(#ssl_tls{type = ?APPLICATION_DATA, fragment = Data}, StateName,
+ #state{start_or_recv_from = From,
+ socket_options = #socket_options{active = false}} = State0) when From =/= undefined ->
+ case ssl_connection:read_application_data(Data, State0) of
+ {stop, _, _} = Stop->
+ Stop;
+ {Record, #state{start_or_recv_from = Caller} = State1} ->
+ TimerAction = case Caller of
+ undefined -> %% Passive recv complete cancel timer
+ [{{timeout, recv}, infinity, timeout}];
+ _ ->
+ []
+ end,
+ {next_state, StateName, State, Actions} = next_event(StateName, Record, State1, TimerAction),
+ ssl_connection:hibernate_after(StateName, State, Actions)
+ end;
handle_protocol_record(#ssl_tls{type = ?APPLICATION_DATA, fragment = Data}, StateName, State0) ->
case ssl_connection:read_application_data(Data, State0) of
{stop, _, _} = Stop->