aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2018-01-04 11:15:30 +0100
committerIngela Anderton Andin <[email protected]>2018-01-04 11:15:30 +0100
commit31782c3accacafb20bc7efd46004921aea8f9f22 (patch)
treeac76571d3e6ae3b1bcb5c7d257f80943ac41965b /lib/ssl
parent93042b54da6a576b187bfb7b2222fc8a5a4d4f12 (diff)
parentd7e1ea1b59f0ba2b93bb0b9fea90533110c8afa1 (diff)
downloadotp-31782c3accacafb20bc7efd46004921aea8f9f22.tar.gz
otp-31782c3accacafb20bc7efd46004921aea8f9f22.tar.bz2
otp-31782c3accacafb20bc7efd46004921aea8f9f22.zip
Merge branch 'ingela/ssl/error-handling-race/ERL-539/OTP-14852' into maint
* ingela/ssl/error-handling-race/ERL-539/OTP-14852: ssl: Prevent error handling race condition
Diffstat (limited to 'lib/ssl')
-rw-r--r--lib/ssl/src/tls_connection.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl
index b033eea261..39f3ed996e 100644
--- a/lib/ssl/src/tls_connection.erl
+++ b/lib/ssl/src/tls_connection.erl
@@ -438,8 +438,10 @@ init(Type, Event, State) ->
error({call, From}, {start, _Timeout}, {Error, State}) ->
{stop_and_reply, normal, {reply, From, {error, Error}}, State};
-error({call, _} = Call, Msg, State) ->
- gen_handshake(?FUNCTION_NAME, Call, Msg, State);
+error({call, From}, {start, _Timeout}, #state{protocol_specific = #{error := Error}} = State) ->
+ {stop_and_reply, normal, {reply, From, {error, Error}}, State};
+error({call, _} = Call, Msg, {Error, #state{protocol_specific = Map} = State}) ->
+ gen_handshake(?FUNCTION_NAME, Call, Msg, State#state{protocol_specific = Map#{error => Error}});
error(_, _, _) ->
{keep_state_and_data, [postpone]}.