aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorgetong <[email protected]>2018-08-02 21:33:30 +0800
committergetong <[email protected]>2018-08-08 20:31:02 +0800
commit87721a511f2c9c5cc3ebb81804bc52191c280bdf (patch)
treef0b4d782abbc315acc033ac1a05fe5c90c2f36f3 /lib
parent783172ca6d0453e115e038edbb46f892c0d35241 (diff)
downloadotp-87721a511f2c9c5cc3ebb81804bc52191c280bdf.tar.gz
otp-87721a511f2c9c5cc3ebb81804bc52191c280bdf.tar.bz2
otp-87721a511f2c9c5cc3ebb81804bc52191c280bdf.zip
use ssl:handshake/1 function
Diffstat (limited to 'lib')
-rw-r--r--lib/ssl/examples/src/client_server.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/ssl/examples/src/client_server.erl b/lib/ssl/examples/src/client_server.erl
index c150f43bff..7a266f544d 100644
--- a/lib/ssl/examples/src/client_server.erl
+++ b/lib/ssl/examples/src/client_server.erl
@@ -39,15 +39,15 @@ start() ->
%% Accept
{ok, ASock} = ssl:transport_accept(LSock),
- ok = ssl:ssl_accept(ASock),
+ {ok, SslSocket} = ssl:handshake(ASock),
io:fwrite("Accept: accepted.~n"),
- {ok, Cert} = ssl:peercert(ASock),
+ {ok, Cert} = ssl:peercert(SslSocket),
io:fwrite("Accept: peer cert:~n~p~n", [public_key:pkix_decode_cert(Cert, otp)]),
io:fwrite("Accept: sending \"hello\".~n"),
- ssl:send(ASock, "hello"),
- {error, closed} = ssl:recv(ASock, 0),
+ ssl:send(SslSocket, "hello"),
+ {error, closed} = ssl:recv(SslSocket, 0),
io:fwrite("Accept: detected closed.~n"),
- ssl:close(ASock),
+ ssl:close(SslSocket),
io:fwrite("Listen: closing and terminating.~n"),
ssl:close(LSock),
@@ -75,7 +75,7 @@ mk_opts(Role) ->
[{active, false},
{verify, 2},
{depth, 2},
+ {server_name_indication, disable},
{cacertfile, filename:join([Dir, Role, "cacerts.pem"])},
{certfile, filename:join([Dir, Role, "cert.pem"])},
{keyfile, filename:join([Dir, Role, "key.pem"])}].
-