aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src/tls_socket.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2018-06-15 22:32:59 +0200
committerIngela Anderton Andin <[email protected]>2018-08-27 15:20:58 +0200
commitd87ac1c55188f5ba5cdf72384125d94d42118c18 (patch)
tree91e4e59a5b9948d7d9f7cdeb490d701551ba2246 /lib/ssl/src/tls_socket.erl
parente24da191701ebd6aa619f9867c9713f696dc95c8 (diff)
downloadotp-d87ac1c55188f5ba5cdf72384125d94d42118c18.tar.gz
otp-d87ac1c55188f5ba5cdf72384125d94d42118c18.tar.bz2
otp-d87ac1c55188f5ba5cdf72384125d94d42118c18.zip
ssl: Add new sender process for TLS state machine
Separate sending and receiving when using TCP as transport as prim_inet:send may block which in turn may result in a deadlock between two Erlang processes communicating over TLS, this is especially likely to happen when running Erlang distribution over TLS.
Diffstat (limited to 'lib/ssl/src/tls_socket.erl')
-rw-r--r--lib/ssl/src/tls_socket.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/ssl/src/tls_socket.erl b/lib/ssl/src/tls_socket.erl
index 154281f1c2..a391bc53de 100644
--- a/lib/ssl/src/tls_socket.erl
+++ b/lib/ssl/src/tls_socket.erl
@@ -64,11 +64,12 @@ accept(ListenSocket, #config{transport_info = {Transport,_,_,_} = CbInfo,
{ok, Socket} ->
{ok, EmOpts} = get_emulated_opts(Tracker),
{ok, Port} = tls_socket:port(Transport, Socket),
- ConnArgs = [server, "localhost", Port, Socket,
+ {ok, Sender} = tls_sender:start(),
+ ConnArgs = [server, Sender, "localhost", Port, Socket,
{SslOpts, emulated_socket_options(EmOpts, #socket_options{}), Tracker}, self(), CbInfo],
case tls_connection_sup:start_child(ConnArgs) of
{ok, Pid} ->
- ssl_connection:socket_control(ConnectionCb, Socket, Pid, Transport, Tracker);
+ ssl_connection:socket_control(ConnectionCb, Socket, [Pid, Sender], Transport, Tracker);
{error, Reason} ->
{error, Reason}
end;
@@ -112,8 +113,8 @@ connect(Address, Port,
{error, {options, {socket_options, UserOpts}}}
end.
-socket(Pid, Transport, Socket, ConnectionCb, Tracker) ->
- #sslsocket{pid = Pid,
+socket(Pids, Transport, Socket, ConnectionCb, Tracker) ->
+ #sslsocket{pid = Pids,
%% "The name "fd" is keept for backwards compatibility
fd = {Transport, Socket, ConnectionCb, Tracker}}.
setopts(gen_tcp, #sslsocket{pid = {ListenSocket, #config{emulated = Tracker}}}, Options) ->