From 5ada450fe10a5fc51b7f3f0900571a10547635a1 Mon Sep 17 00:00:00 2001 From: "j.uhlig" Date: Tue, 26 Jun 2018 17:07:13 +0200 Subject: Introduce Transport:handshake/1,2 This commit deprecates Transport:accept_ack/1 in favor of a new forward-compatible function. Transport:handshake/1,2 will use ssl:handshake/2,3 from Ranch 2.0 onward. --- src/ranch_tcp.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ranch_tcp.erl') diff --git a/src/ranch_tcp.erl b/src/ranch_tcp.erl index bc0c75d..58cbb37 100644 --- a/src/ranch_tcp.erl +++ b/src/ranch_tcp.erl @@ -22,6 +22,7 @@ -export([disallowed_listen_options/0]). -export([accept/2]). -export([accept_ack/2]). +-export([handshake/3]). -export([connect/3]). -export([connect/4]). -export([recv/3]). @@ -100,9 +101,14 @@ accept(LSocket, Timeout) -> gen_tcp:accept(LSocket, Timeout). -spec accept_ack(inet:socket(), timeout()) -> ok. -accept_ack(_, _) -> +accept_ack(CSocket, Timeout) -> + {ok, _} = handshake(CSocket, [], Timeout), ok. +-spec handshake(inet:socket(), opts(), timeout()) -> {ok, inet:socket()}. +handshake(CSocket, _, _) -> + {ok, CSocket}. + %% @todo Probably filter Opts? -spec connect(inet:ip_address() | inet:hostname(), inet:port_number(), any()) -- cgit v1.2.3