Skip to content
Permalink
Browse files
Conditional ssl:handshake/2
  • Loading branch information
etrepum committed Jan 12, 2019
1 parent d7179cf commit 9458608aca9e22043228e50b142fb64665fac6b2
Showing 2 changed files with 14 additions and 1 deletion.
@@ -4,7 +4,8 @@
{platform_define, "^(R14|R15|R16B-)", 'crypto_compatibility'},
{platform_define, "^(R14|R15|R16B|17)", 'rand_mod_unavailable'},
{platform_define, "^(R14|R15|R16B|17)", 'sni_unavailable'},
{platform_define, "^(R14|R15|R16)", 'map_unavailable'}]}.
{platform_define, "^(R14|R15|R16)", 'map_unavailable'},
{platform_define, "^(R14|R15|R16|17|18|19|20)", 'ssl_handshake_unavailable'}]}.
{cover_enabled, true}.
{eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.
{dialyzer_opts, [{warnings, [no_return,
@@ -87,6 +87,17 @@ transport_accept({ssl, ListenSocket}) ->
transport_accept(ListenSocket) ->
gen_tcp:accept(ListenSocket, ?ACCEPT_TIMEOUT).

-ifdef(ssl_handshake_unavailable).
finish_accept({ssl, Socket}) ->
case ssl:ssl_accept(Socket, ?SSL_HANDSHAKE_TIMEOUT) of
ok ->
{ok, {ssl, Socket}};
{error, _} = Err ->
Err
end;
finish_accept(Socket) ->
{ok, Socket}.
-else.
finish_accept({ssl, Socket}) ->
case ssl:handshake(Socket, ?SSL_HANDSHAKE_TIMEOUT) of
{ok, SslSocket} ->
@@ -96,6 +107,7 @@ finish_accept({ssl, Socket}) ->
end;
finish_accept(Socket) ->
{ok, Socket}.
-endif.

recv({ssl, Socket}, Length, Timeout) ->
ssl:recv(Socket, Length, Timeout);

0 comments on commit 9458608

Please sign in to comment.