aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch_tcp.erl
diff options
context:
space:
mode:
authorj.uhlig <[email protected]>2018-06-26 17:07:13 +0200
committerLoïc Hoguin <[email protected]>2018-07-02 09:02:00 +0200
commit5ada450fe10a5fc51b7f3f0900571a10547635a1 (patch)
tree45ac84215485f09ebedce319121ed5f719b30493 /src/ranch_tcp.erl
parentcaeadc82615e9e5ce0c2d92f882cad7b9cb7322d (diff)
downloadranch-5ada450fe10a5fc51b7f3f0900571a10547635a1.tar.gz
ranch-5ada450fe10a5fc51b7f3f0900571a10547635a1.tar.bz2
ranch-5ada450fe10a5fc51b7f3f0900571a10547635a1.zip
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.
Diffstat (limited to 'src/ranch_tcp.erl')
-rw-r--r--src/ranch_tcp.erl8
1 files changed, 7 insertions, 1 deletions
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())