You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2021/05/08 18:34:04 UTC

[couchdb-ibrowse] branch upstream updated: Use ssl:handshake/2 in test server on Erlang 21+ versions (#172)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch upstream
in repository https://gitbox.apache.org/repos/asf/couchdb-ibrowse.git


The following commit(s) were added to refs/heads/upstream by this push:
     new de04453  Use ssl:handshake/2 in test server on Erlang 21+ versions (#172)
de04453 is described below

commit de04453d7920ce24b9edb57080173c67262fcc51
Author: Nick Vatamaniuc <ni...@users.noreply.github.com>
AuthorDate: Sat May 8 02:24:43 2021 -0400

    Use ssl:handshake/2 in test server on Erlang 21+ versions (#172)
    
    `ssl:ssl_acceppt` is deprecated. We use the `OTP_RELEASE` define which exists
    on OTP 21+ only.
---
 test/ibrowse_test_server.erl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/ibrowse_test_server.erl b/test/ibrowse_test_server.erl
index 3ba7c67..631e93a 100644
--- a/test/ibrowse_test_server.erl
+++ b/test/ibrowse_test_server.erl
@@ -76,11 +76,22 @@ do_listen(ssl, Port, Opts) ->
     application:start(ssl),
     ssl:listen(Port, Opts).
 
+-ifdef(OTP_RELEASE).
+
+do_accept(tcp, Listen_sock) ->
+    gen_tcp:accept(Listen_sock, ?ACCEPT_TIMEOUT_MS);
+do_accept(ssl, Listen_sock) ->
+    ssl:handshake(Listen_sock, ?ACCEPT_TIMEOUT_MS).
+
+-else.
+
 do_accept(tcp, Listen_sock) ->
     gen_tcp:accept(Listen_sock, ?ACCEPT_TIMEOUT_MS);
 do_accept(ssl, Listen_sock) ->
     ssl:ssl_accept(Listen_sock, ?ACCEPT_TIMEOUT_MS).
 
+-endif.
+
 accept_loop(Sock, Sock_type) ->
     case do_accept(Sock_type, Sock) of
         {ok, Conn} ->