Browse Source

use ssl:handshake/2 function for erlang/otp 21

pull/165/head
getong 6 years ago
parent
commit
9b6ed600f6
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      test/ibrowse_test_server.erl

+ 13
- 1
test/ibrowse_test_server.erl View File

@ -79,7 +79,15 @@ do_listen(ssl, Port, Opts) ->
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).
handleshake(Listen_sock, ?ACCEPT_TIMEOUT_MS).
-ifdef(OTP_RELEASE).
handleshake(Listen_sock, Timeout) ->
ssl:handshake(Listen_sock, Timeout).
-else.
handleshake(Listen_sock, Timeout) ->
ssl:ssl_accept(Listen_sock, Timeout).
-endif.
accept_loop(Sock, Sock_type) ->
case do_accept(Sock_type, Sock) of
@ -87,6 +95,10 @@ accept_loop(Sock, Sock_type) ->
Pid = spawn_link(fun() -> connection(Conn, Sock_type) end),
set_controlling_process(Conn, Sock_type, Pid),
accept_loop(Sock, Sock_type);
ok ->
Pid = spawn_link(fun() -> connection(Sock, Sock_type) end),
set_controlling_process(Sock, Sock_type, Pid),
accept_loop(Sock, Sock_type);
{error, timeout} ->
receive
stop ->

Loading…
Cancel
Save