diff options
author | Erlang/OTP <[email protected]> | 2010-04-08 09:05:34 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-04-08 09:05:34 +0000 |
commit | e84e8a42a1ad4025156b5ae8926575c7f08fadb6 (patch) | |
tree | 795353f9ae12895b14671fd3fbbab914ae7c083f /lib/ssl/src | |
parent | 899f040789a9a0cda2ee2b2555da6f6805308575 (diff) | |
parent | 0e502e41948e8835920ce82bb84405b141a00eaa (diff) | |
download | otp-e84e8a42a1ad4025156b5ae8926575c7f08fadb6.tar.gz otp-e84e8a42a1ad4025156b5ae8926575c7f08fadb6.tar.bz2 otp-e84e8a42a1ad4025156b5ae8926575c7f08fadb6.zip |
Merge branch 'rb/ssl-transport-accept-fix' into dev
* rb/ssl-transport-accept-fix:
Fix ssl:transport_accept/2 to return properly when socket is closed
OTP-8560 rb/ssl-transport-accept-fix
Fixed ssl:transport_accept/2 to return properly when socket is closed.
Thanks to Rory Byrne.
Diffstat (limited to 'lib/ssl/src')
-rw-r--r-- | lib/ssl/src/ssl.erl | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl index 965e40a109..da5f750762 100644 --- a/lib/ssl/src/ssl.erl +++ b/lib/ssl/src/ssl.erl @@ -154,17 +154,21 @@ transport_accept(#sslsocket{pid = {ListenSocket, #config{cb=CbInfo, ssl=SslOpts} EmOptions = emulated_options(), {ok, InetValues} = inet:getopts(ListenSocket, EmOptions), {CbModule,_,_} = CbInfo, - {ok, Socket} = CbModule:accept(ListenSocket, Timeout), - inet:setopts(Socket, internal_inet_values()), - {ok, Port} = inet:port(Socket), - case ssl_connection_sup:start_child([server, "localhost", Port, Socket, - {SslOpts, socket_options(InetValues)}, self(), - CbInfo]) of - {ok, Pid} -> - CbModule:controlling_process(Socket, Pid), - {ok, SslSocket#sslsocket{pid = Pid}}; - {error, Reason} -> - {error, Reason} + case CbModule:accept(ListenSocket, Timeout) of + {ok, Socket} -> + inet:setopts(Socket, internal_inet_values()), + {ok, Port} = inet:port(Socket), + ConnArgs = [server, "localhost", Port, Socket, + {SslOpts, socket_options(InetValues)}, self(), CbInfo], + case ssl_connection_sup:start_child(ConnArgs) of + {ok, Pid} -> + CbModule:controlling_process(Socket, Pid), + {ok, SslSocket#sslsocket{pid = Pid}}; + {error, Reason} -> + {error, Reason} + end; + {error, Reason} -> + {error, Reason} end; transport_accept(#sslsocket{} = ListenSocket, Timeout) -> |